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,
Thanks for your feedback. How do you data-bind the dropdowns ? More importantly, how many items do you have in the dropdown? If you have thousands of items, i would indeed expect a performance degradation - which can be fixed in several ways - using paging, load on demand, or EnableAutoFiltering=Server, which will set lazy loading of items and no objects will be created at once. But this is only related to the dropdown performance, it shouldn't affect page performance. That's because all client-side logic and events listen and are applied to the dropdown elements only, not to any other page elements.
Thanks,
Angel
I have the problem to use webdropdown,
I found webdropdown_selectedchanged event on events queue, it fires utile another bostback. even I set attribute postback= true for select change. I really want to know why??
Thnaks.
Martin
Angel, you have been EXTREMELY helpful! thank you very much.
I was binding on the initial, but not the post back.
Thank you again!
I am marking this as fixed. Would it be possible for you to look at my thread about not getting all of the images imported?
this is my last thing for this particular page
http://forums.infragistics.com/forums/t/26721.aspx
In my example ViewState is disabled, and this works fine. In fact if ViewState is Enabled, it's not needed to DataBind on every postback, only on the first page load.
that works as long as view state is not disabled on the webdropdown.
PopulateDDLs is called on the PageLoad
I am not sure where is your PopulateDDLs() method called. Since you are calling DataBind() there, you should make sure it is called before the Button Clicked event handler. I tried this code and it works fine :
protected void Page_Load(object sender, EventArgs e)
{
WebDropDown1.DataBind();
}
protected void Unnamed2_Click(object sender, EventArgs e)
string selVal = WebDropDown1.SelectedValue;
Still getting the Oject not set to an instance of an object error.
Here is the Button click Even that fires to update the DB
protected void btnAddPM_Click(object sender, EventArgs e) { WebDropDown ddlAddPM = (WebDropDown)gvPM.Rows[0].FindControl("ddlAddPM"); AddRole(int.Parse(ddlAddPM.SelectedValue), "pm"); BindUpdatedGrid(((GridView)gvPM.Rows[0].FindControl("gvPMDetails")), "pm"); }
Here is the function called from the page load to Bind the DDL's
private void PopulateDDLs() { WebDropDown ddlAddContracts = (WebDropDown)gvContracts.Rows[0].FindControl("ddlAddContracts"); WebDropDown ddlAddSubcontracts = (WebDropDown)gvSubcontracts.Rows[0].FindControl("ddlAddSubcontracts"); WebDropDown ddlAddFinance = (WebDropDown)gvFinance.Rows[0].FindControl("ddlAddFinance"); WebDropDown ddlAddPM = (WebDropDown)gvPM.Rows[0].FindControl("ddlAddPM"); WebDropDown ddlAddBilling = (WebDropDown)gvBilling.Rows[0].FindControl("ddlAddBilling"); WebDropDown ddlAddConsultant = (WebDropDown)gvConsultant.Rows[0].FindControl("ddlAddConsultant"); WebDropDown ddlAddCorporateSecurity = (WebDropDown)gvCorporateSecurity.Rows[0].FindControl("ddlAddCorporateSecurity"); WebDropDown ddlAddCustomer = (WebDropDown)gvCustomer.Rows[0].FindControl("ddlAddCustomer"); WebDropDown ddlAddExternal = (WebDropDown)gvExternal.Rows[0].FindControl("ddlAddExternal"); WebDropDown ddlAddLegal = (WebDropDown)gvLegal.Rows[0].FindControl("ddlAddLegal"); WebDropDown ddlAddPricing = (WebDropDown)gvPricing.Rows[0].FindControl("ddlAddPricing"); List<User> users = ContractInfo.ScrubAllUserNames(); List<User> usedUsers = ContractInfo.GetScrubbedUsersByContract(_conId); var userIds = (from u in usedUsers select u.id); List<User> remainingUsers = (from u in users where !userIds.Contains(u.id) select u).ToList(); ddlAddPM.DataSource = ddlAddContracts.DataSource = ddlAddSubcontracts.DataSource = ddlAddConsultant.DataSource = ddlAddFinance.DataSource = ddlAddBilling.DataSource = ddlAddConsultant.DataSource = ddlAddPricing.DataSource = ddlAddCorporateSecurity.DataSource = ddlAddCustomer.DataSource = ddlAddExternal.DataSource = ddlAddLegal.DataSource = remainingUsers; ddlAddPM.DataBind(); ddlAddContracts.DataBind(); ddlAddSubcontracts.DataBind(); ddlAddFinance.DataBind(); ddlAddBilling.DataBind(); ddlAddConsultant.DataBind(); ddlAddCorporateSecurity.DataBind(); ddlAddCustomer.DataBind(); ddlAddExternal.DataBind(); ddlAddLegal.DataBind(); ddlAddPricing.DataBind(); ddlAddPM.Items.Insert(0, new DropDownItem("", "")); ddlAddContracts.Items.Insert(0, new DropDownItem("", "")); ddlAddSubcontracts.Items.Insert(0, new DropDownItem("", "")); ddlAddFinance.Items.Insert(0, new DropDownItem("", "")); ddlAddBilling.Items.Insert(0, new DropDownItem("", "")); ddlAddConsultant.Items.Insert(0, new DropDownItem("", "")); ddlAddCorporateSecurity.Items.Insert(0, new DropDownItem("", "")); ddlAddCustomer.Items.Insert(0, new DropDownItem("", "")); ddlAddExternal.Items.Insert(0, new DropDownItem("", "")); ddlAddLegal.Items.Insert(0, new DropDownItem("", "")); ddlAddPricing.Items.Insert(0, new DropDownItem("", "")); }