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
yes it is ony one row of binding. Kind of hard to explain, but how we had to do it for this. I have used the webgrid with a ddl row. Really nice solution most of the time. In this case, I have a master gridview, with an embedded gridview, and a table below the embedded gridview for adding peoples roles to the grid.
I change thed the enableautofiltering="server" and got no speed up at all.
Hopefully you have more suggestions? It really seems to be a problem with the webdropdown.
This page in general is giving me grief. Async panels just flat out do not work on top of this.
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
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 Angel, That got it!
I did 2 and 3
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.
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("", "")); }