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>
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
Hi,
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.
Thanks,
Angel
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("", "")); }