datalist with embedded dropdownlist question 2.) [solved]
-
I have a datalist which includes an embedded dropdownlist. The datalist is similar to a simple shopping cart. The dropdownlist is the qty required. I've been able to set the extend price etc, but I'm also trying to set the selected qty of this dropdownlist. It doesn't seem to like any embedded <%# eval()%> in the html. The qty is updated in the database and is returned. This is the html: =================================================================== <asp:DropDownList ID="ddlQty" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlQty_Changed" > <asp:listitem runat="server" value="1" Selected='<%# Eval("itemqty")==1 %>' /> <asp:listitem runat="server" value="2" Selected='<%# Eval("itemqty")==2 %>' /> <asp:listitem runat="server" value="3" Selected='<%# Eval("itemqty")==3 %>' /> <asp:listitem runat="server" value="4" Selected='<%# Eval("itemqty")==4 %>' /> <asp:listitem runat="server" value="5" Selected='<%# Eval("itemqty")==5 %>' /> asp:DropDownList ==================================================================== Error: Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.ListItem does not have a DataBinding event. Any ideas?:confused: For referenc, my initial C# question was on 11/5/2009. Used C# to update the selected value while looping thru the dataset and the datalist.:thumbsup:
modified on Thursday, November 12, 2009 3:29 PM