Event for dropdown control created at runtime.URGENT!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a situation where the list of tables(database) and the columns for each table must be displayed for selection. for each member(displayed in each row) i have to select a table and a column from that table. since the number of rows are dynamic i am creating as below...

Dim tRow As New TableRow()
Dim tCell1 As New TableCell(), tCell2 As New TableCell(), tCell3 As New TableCell()


'Create the dropdown to display the tables
Dim ddlDesTabs As New DropDownList()
ddlDesTabs.ID = "ddlDesTabs" & intRow
ddlDesTabs.DataSource = arrDDValues
ddlDesTabs.DataBind()
ddlDesTabs.Items.Insert(0, "Select Table")
tCell2.Controls.Add(ddlDesTabs)

'Add cell 2 to the row
tRow.Cells.Add(tCell2)

'Create the dropdown to display the columns in each table
Dim ddlDesCols As New DropDownList()
ddlDesCols.ID = "ddlDesCols" & intRow
ddlDesCols.DataSource = arrColVals
ddlDesCols.DataBind()
ddlDesCols.Items.Insert(0, "Select Column")
tCell3.Controls.Add(ddlDesCols)

'Add cell 3 to the row
tRow.Cells.Add(tCell3)

'Add the row
tblSourceDetails.Rows.Add(tRow)



now, can someone help me how to add event to the dropdown created at runtime and also how to bind two dropdowns, i.e when i select first one , only items related to that selection must be displayed in second dropdown.
Please send your ideas or and links for the same at the earliest as its most urgent.
 
Hi,

1) add those dropdowns in the page load event. use the AddHandler
statement to attach delegates to methods.

AddHandler SelectedIndexChanged, AddressOf MyFunc;
...
private sub MyFunc(object sender, System.EventArgs e)


end sub


Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
Back
Top