Dropdownlist doesn't go to selectedindex after postback
Hi,
My dropdownlist doesn't go to selectedindex after page is
post back, any idea whats wrong with the below?
<%
If Not Page.IsPostBack Then
CategoryID.Datasource = dsCategory.DefaultView
CategoryID.EnableViewState = True
CategoryID.DataBind()
End If
%>
<% CategoryID.SelectedIndex = CategoryID.Items.IndexOf(CategoryID.Items.FindByValue(dsCategory.FieldValue("category_id", Nothing) )) %>
<asp:DropDownList ID="CategoryID" DataSource='<%# dsCategory.DefaultView %>' DataTextField="name" DataValueField="id" runat="server"></asp:DropDownList>
<asp:ImageButton ID="btnSubmit" AlternateText="Submit" runat="server" />
Re: Dropdownlist doesn't go to selectedindex after postback
i think an onselectindexchange to pass into your ddl may help do the job.
See this thread for more info: http://www.vbforums.com/showthread.p...t=dropdownlist