Binded DropDown list

  • Thread starter Thread starter Mira Vizjak
  • Start date Start date
M

Mira Vizjak

Hi
I'm using a datagrid with a dropdown list in it. The dropdown list is filled
with values from SQL database, it's autopostback property is set to true and
when I select another item in it, the SelectedIndexChanged event fires
properly, but I can't the index or value of the selected item. SelectedValue
and SelectedItem is Nothing, Request.Params("DropDown1") is empty as well.
Thanks for your help!

Jure
 
Please post some code snippet.
Probably you fill dropdown every time, use IsPostBack property to fill it
only first time you enter the page.
Also check if EnableViewState of dropdown and page is set to true.
 
Sorry, can not see any connection between refill dropdown and empty Datagrid
???
Please explain.
 
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Security.IsInRoles("Admins") = False Then
Response.Redirect("default.aspx")
End If
If Page.IsPostBack=False then
BindGrid()
End If
End Sub
In this case when I select an item from ddl control the datagrid on the page
posted back is empty.

If Security.IsInRoles("Admins") = False Then
Response.Redirect("default.aspx")
End If
BindGrid()
End Sub
In this case when I select an item from ddl control the datagrid on the page
posted back is full.
 
I can't see from code you post where do you fill the dropdown.
Fill it once when Not IsPostBack.
 
Back
Top