A
Andrew Morton
I'm creating DropDownList controls at run-time, and I've found I have to add
the onchange event myself (.Attributes.Add(...) below).
Is that the way it's meant to happen, or have I missed something that would
automatically add the onchange event?
U = New DropDownList
With U
.DataSource = dv
.DataTextField = "myChoice"
.DataValueField = "myValue"
.DataBind()
' n is the number of this control
.ID = "U_" & n.ToString
' select the current value
For k As Integer = 0 To UBound(usageValues)
If CStr(entry("usage")) = usageValues(k) Then
.SelectedIndex = k
Exit For
End If
Next
AddHandler .SelectedIndexChanged, AddressOf
ModifyUsage_SelectedIndexChanged
.Attributes.Add("onchange", "__doPostBack('U_" & n.ToString & "')")
End With
Andrew
the onchange event myself (.Attributes.Add(...) below).
Is that the way it's meant to happen, or have I missed something that would
automatically add the onchange event?
U = New DropDownList
With U
.DataSource = dv
.DataTextField = "myChoice"
.DataValueField = "myValue"
.DataBind()
' n is the number of this control
.ID = "U_" & n.ToString
' select the current value
For k As Integer = 0 To UBound(usageValues)
If CStr(entry("usage")) = usageValues(k) Then
.SelectedIndex = k
Exit For
End If
Next
AddHandler .SelectedIndexChanged, AddressOf
ModifyUsage_SelectedIndexChanged
.Attributes.Add("onchange", "__doPostBack('U_" & n.ToString & "')")
End With
Andrew