why is it that having a web drop down in this instance makes the page crawl? Button clicks take 5 or more seconds. They get stuck. If I revert back to a regular ASP DDL, it runs like a champ.
<td style="width:50%; text-align:right">
<ig:WebDropDown runat="server" ID="ddlAddPM" TextField="UserMachineName" Width="250px" DisplayMode="DropDownList" DropDownContainerMaxHeight="150px" EnableDropDownAsChild="false" ValueField="Id" >
</ig:WebDropDown>
<asp:RequiredFieldValidator runat="server" ControlToValidate="ddlAddPM" Display="None" ErrorMessage="Select a user from the Drop Down List" ValidationGroup="PM" />
</td>
<td style="width:50%; text-align:left">
<asp:Button ID="btnAddPM" runat="server" Text="Assign PM Role" OnClick="btnAddPM_Click" ValidationGroup="PM" />
<asp:ValidationSummary runat="server" ValidationGroup="PM" DisplayMode="List" ShowMessageBox="true" ShowSummary="false" />
<asp:DropDownList runat="server" ID="ddlAddPM" DataTextField="UserMachineName" Width="250px" DataValueField="Id" >
</asp:DropDownList>
Hi,
Yep, to get this to work, you only need to call DataBind() on the dropdown instance in the code behind, before accessing the SelectedValue.
When ViewState is turned off, we always need to data bind (not only for the dropdown, but for all asp.net controls in general).
Example:
protected void Page_Load(object sender, EventArgs e)
{
WebDropDown1.DataBind();
string selVal = WebDropDown1.SelectedValue;
}
Hope this helps,
Angel
so I thought that was it.
with view state off, the selected item always comes back as null.
now, i cannot get the selected item's value to put into the DB.
ddlAddPm.SelectedItem.Value throws a null reference exception.
Thanks Angel, That got it!
I did 2 and 3
I also suggest the following:
1) Put EnableLoadOnDemand=true or EnablePaging=true and PageSize=10 or PageSize=20 for all dropdowns
or
2) set EnableAutoFiltering=Server
and / or
3) set EnableViewState=false for all dropdowns.
This should certainly help, in my opinion. If you still encounter issues, please let me know.
Point 3) on its own may fix your issue, but i suggest combining it with 1) or 2).
Thanks,
More info to add for anyone that may have a solution.
I had to add a few more grids w/ drop downs to the page. Now I get this error. So I think Angels suspicion of scripts slowing me down is correct, now just how to fix it. As soon as I click yes, everything runs in <1 sec