>>>private void _LoadList() >>>{ >>> DataLayer.ProviderInvariantName = "System.Data.SqlClient"; >>> DataLayer.ConnectionString = ConfigurationManager.ConnectionStrings["ApexGlobalConnectionString"].ConnectionString; >>> >>> dsRoles = DataLayer.ExecuteQuery("as_GetRole", CommandType.StoredProcedure); >>> >>> lstRoles.DataSource = dsRoles.Tables[0]; >>> lstRoles.DataTextField = "RoleName"; >>> lstRoles.DataBind(); >>>} >>> >>>>>>
lstRoles.Rows = dsRoles.Tables[0].Rows.Count;>
><asp:ListBox ID="lstRoles" Height="100%" Width="100%" runat="server" AutoPostBack = "true" OnSelectedIndexChanged="lstRoles_SelectedIndexChanged"></asp:ListBox> >>
><asp:ListBox ID="ListBox1" Height="200" Width="100%" runat="server" AutoPostBack = "true" OnSelectedIndexChanged="lstRoles_SelectedIndexChanged"></asp:ListBox> >If you want a fixed number of rows it's better to set the number of rows rather than an explicit height. e.g:
><asp:ListBox ID="ListBox1" Rows="3" Width="100%" runat="server" AutoPostBack = "true" OnSelectedIndexChanged="lstRoles_SelectedIndexChanged"></asp:ListBox>