J
j_stus
Hello there
I was trying to find something about this on web but with no success.
I am using code behind.
Basically I am creating drop down list dynamically.
Everything works but calling SelectedIndexChanged event never fires up.
I found some discussions regarding this problem, but couldn't find
answer....
Here is my code.
Protected WithEvents ddl As System.Web.UI.WebControls.DropDownList
For z = 0 To dg.Items.Count - 1
ddl = New System.Web.UI.WebControls.DropDownList
ddl.Style("width") = "150"
ddl.ID = z.ToString
ddl.DataSource = dstCust
ddl.DataTextField = "cust_name"
ddl.DataValueField = "cust_id"
ddl.DataBind()
ddl.Attributes.Add("onchange", "return
(ddl_SelectedIndexChanged(New Object, New System.EventArgs));")
dg.Items(z).Cells(1).Controls.Add(ddl)
Next
Private Sub ddl_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ddl.SelectedIndexChanged
Dim x As String = "This function is never called!!!!!!!"
End Sub
I was trying to find something about this on web but with no success.
I am using code behind.
Basically I am creating drop down list dynamically.
Everything works but calling SelectedIndexChanged event never fires up.
I found some discussions regarding this problem, but couldn't find
answer....
Here is my code.
Protected WithEvents ddl As System.Web.UI.WebControls.DropDownList
For z = 0 To dg.Items.Count - 1
ddl = New System.Web.UI.WebControls.DropDownList
ddl.Style("width") = "150"
ddl.ID = z.ToString
ddl.DataSource = dstCust
ddl.DataTextField = "cust_name"
ddl.DataValueField = "cust_id"
ddl.DataBind()
ddl.Attributes.Add("onchange", "return
(ddl_SelectedIndexChanged(New Object, New System.EventArgs));")
dg.Items(z).Cells(1).Controls.Add(ddl)
Next
Private Sub ddl_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ddl.SelectedIndexChanged
Dim x As String = "This function is never called!!!!!!!"
End Sub