S
Shawn
Hi.
I'm trying to add an event to a DropDownList from my code, but so far I
haven't been able to do it right. The DropDownList is inside a DataGrid. The
reason why I'm not adding an onSelectedIndexChanged attribute in the html
code is because not all of the DropDownLists in the DataGrid is to have this
event. Here is a simplified version of my code:
For i = 0 To dgParameter.Items.Count - 1
dataGridItem = dgParameter.Items(i)
myDDL = CType(dataGridItem.FindControl("ddlValue"), DropDownList)
myDDL.AutoPostBack = True
AddHandler myDDL.SelectedIndexChanged, AddressOf
myDDL_SelectedIndexChanged
Next
Public Sub myDDL_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
'...
'...
End Sub
I tried replacing the AddHandler line with this one, but still nothing.
myDDL.Attributes.Add("onselectedindexchanged", "myDDL_SelectedIndexChanged")
Any help appreciated!
Thanks,
Shawn
I'm trying to add an event to a DropDownList from my code, but so far I
haven't been able to do it right. The DropDownList is inside a DataGrid. The
reason why I'm not adding an onSelectedIndexChanged attribute in the html
code is because not all of the DropDownLists in the DataGrid is to have this
event. Here is a simplified version of my code:
For i = 0 To dgParameter.Items.Count - 1
dataGridItem = dgParameter.Items(i)
myDDL = CType(dataGridItem.FindControl("ddlValue"), DropDownList)
myDDL.AutoPostBack = True
AddHandler myDDL.SelectedIndexChanged, AddressOf
myDDL_SelectedIndexChanged
Next
Public Sub myDDL_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
'...
'...
End Sub
I tried replacing the AddHandler line with this one, but still nothing.
myDDL.Attributes.Add("onselectedindexchanged", "myDDL_SelectedIndexChanged")
Any help appreciated!
Thanks,
Shawn