M
mrwoopey
I did not find code for adding an event to dropdownlist in a repeater
control posted anywhere. So, I am posting it for the next person
(sorry if this seems obvious to you):
''''''''''''''''''''
Private Sub MyRepeater_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
MyRepeater.ItemCreated
Dim strValue As String
Dim objCTL As Control
For Each objCTL In e.Item.Controls
strValue = objCTL.GetType.ToString
If strValue = "System.Web.UI.WebControls.DropDownList"
Then
' 'add the click event and point to existing click
event
Dim objDDL As DropDownList = DirectCast(objCTL,
DropDownList)
AddHandler objDDL.SelectedIndexChanged, AddressOf
ddlINFO_SelectedIndexChanged
End If
Next
End Sub
Private Sub ddlINFO_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles ddlMapTarget.SelectedIndexChanged
'note make sure that ddlINFO has a autopostback="True" for for
this work
Dim objDDL As DropDownList = CType(sender, DropDownList)
lblMessage.Text = objDDL.SelectedValue()
lblMessage.Visible = True
End Sub
''''''''''''''
Phin
control posted anywhere. So, I am posting it for the next person
(sorry if this seems obvious to you):
''''''''''''''''''''
Private Sub MyRepeater_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
MyRepeater.ItemCreated
Dim strValue As String
Dim objCTL As Control
For Each objCTL In e.Item.Controls
strValue = objCTL.GetType.ToString
If strValue = "System.Web.UI.WebControls.DropDownList"
Then
' 'add the click event and point to existing click
event
Dim objDDL As DropDownList = DirectCast(objCTL,
DropDownList)
AddHandler objDDL.SelectedIndexChanged, AddressOf
ddlINFO_SelectedIndexChanged
End If
Next
End Sub
Private Sub ddlINFO_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles ddlMapTarget.SelectedIndexChanged
'note make sure that ddlINFO has a autopostback="True" for for
this work
Dim objDDL As DropDownList = CType(sender, DropDownList)
lblMessage.Text = objDDL.SelectedValue()
lblMessage.Visible = True
End Sub
''''''''''''''
Phin