hi

i'm using a dropdown to enable the users to choose the product family in (or on, i don´t know... :-( ) a form. when the user clicks in the save button, it saves all info into the database, including the family_product_id, with the selectedvalue property... the problem is that this value is always the value of the initial first item of the dropdown, never the selected value...i don´t know why.
enable postback didn't help....

help........................................................

please check your page_load function and check your IsPostBack code.
it should have some problem at there.

this is the code to populate the dropdown, in the load_page event:

DBliga = New OleDbConnection(func.connect)
    DBliga.Open()
    DBcomando = New OleDbCommand("SELECT DISTINCT [id_familia], [nome] FROM [familia_prod] ORDER BY [nome]", DBliga)
   
    DDLtipo.DataSource = DBcomando.ExecuteReader(CommandBehavior.CloseConnection)
    DDLtipo.DataBind()
    DBliga.Close()
    
    If Not Page.IsPostBack Then
      DDLtipo.SelectedValue = func.seleccionar2("SELECT id_familia FROM produtos WHERE id_produto = " & CInt(Request.QueryString("id")))
    End If

and the AutoPostBack property of the control is set to false, i can´t set it to true in this case.

well, this doesn´t work, but then i set the AppendDataBoundItems property to true and it works great now... although i don´t really understand why...

yup, all your code is correct, except the If Not Page.IsPostBack Then.
you should put If Page.IsPostBack Then

Hope it can help you.:)

thank you kokkee.
it works fine both ways, but while testing like you said i found a tiny bug :)
well, now everything works...finally

welcome, i still new in helping people solve problem. anywhere, everything need to try. haha

This question has already been answered. Start a new discussion instead.