A
Ashish Sharma
I have a DropDownList inside a DataList on a page. I want to set the
selectedindex property of the DropDownList to some value.
I bind the DropDownList on the ItemCreated Event of the DataList.
Private Sub DataList1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs) Handles
DataList1.ItemCreated
Dim ddl As DropDownList
ddl = CType(e.Item.FindControl("DropDownList1"), DropDownList)
ddl.DataSource = GetDropDownListData
ddl.DataBind()
ddl.SelectedIndex = 2
end sub
but this does not sets the selected index and the selected index comes
out to be default ( i.e 0)
Where should i set this property so that it displays on the rendered code
Any help would be appreciated
TIA
-ashish
selectedindex property of the DropDownList to some value.
I bind the DropDownList on the ItemCreated Event of the DataList.
Private Sub DataList1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs) Handles
DataList1.ItemCreated
Dim ddl As DropDownList
ddl = CType(e.Item.FindControl("DropDownList1"), DropDownList)
ddl.DataSource = GetDropDownListData
ddl.DataBind()
ddl.SelectedIndex = 2
end sub
but this does not sets the selected index and the selected index comes
out to be default ( i.e 0)
Where should i set this property so that it displays on the rendered code
Any help would be appreciated
TIA
-ashish