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) )) %>

<aspropDownList ID="CategoryID" DataSource='<%# dsCategory.DefaultView %>' DataTextField="name" DataValueField="id" runat="server"></aspropDownList>

<asp:ImageButton ID="btnSubmit" AlternateText="Submit" runat="server" />