I have 2 dropdownlist controls on my web form page. The page content sits inside an update panel on my master page.
When one dropdown is changed, the items in the other dropdown are populated based on the selection made. This is done via a web service call.
When I then call a button click event, no value is returned by my dependent dropdown control.
I have also overridden the Render event to prevent Event Validation problems.Code:<li style="clear: both;"> <asp:Label ID="lblCategory" runat="server" Text="Product Category" /> <span class="red bold size_12" style="text-align: left; width: 5px; cursor: help;" title="Required">*</span> <asp:DropDownList ID="ddlCategory" runat="server" CssClass="blue_333399 size_9 textbox" DataValueField="id" DataTextField="category" /> <asp:RequiredFieldValidator ID="rfvCategory" runat="server" ControlToValidate="ddlCategory" ErrorMessage="Please select the category" Display="None" EnableClientScript="true" ValidationGroup="evalproduct" /> </li> <li style="clear: both;"> <asp:Label ID="lblReceptor" runat="server" Text="Product Receptor" /> <span class="red bold size_12" style="text-align: left; width: 5px; cursor: help;" title="Required">*</span> <asp:DropDownList ID="ddlReceptor" runat="server" CssClass="blue_333399 size_9 textbox" style="display:none;" /> <div id="pHReceptor" class="blue_333399 size_9" style="line-height:23px;">Please select a product category</div> </li>
In my button click event though, ddlReceptor.SelectedValue is coming back blank.Code:protected override void Render(HtmlTextWriter writer) { this.ddlReceptor.DataSource = Receptor.GetAllReceptorList(); this.ddlReceptor.DataValueField = "id"; this.ddlReceptor.DataTextField = "receptor"; this.ddlReceptor.DataBind(); this.ddlReceptor.Items.Add(new ListItem("None", "0")); base.Render(writer); }
Any ideas?



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks