Event for dropdown control created at runtime.URGENT!

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.
 
N

Natty Gur

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top