Results 1 to 2 of 2

Thread: Dropdownlist doesn't go to selectedindex after postback

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    67

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

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

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

  2. #2
    Lively Member
    Join Date
    May 2005
    Posts
    106

    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
    Last edited by john83; May 25th, 2005 at 12:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width