Dynamic DropDownList - Retrieving the controls properties(id, selectedindex, etc...)

A

aesquivel

This is being built on dynamicly based on what is returned from my query. Build in the LoadMain() which is called from the Page_Load. I have built a DropDownList and I am using an AddHandler to process the SelectedIndexChanged. (CODE BELOW).
*******************************************************************
'Add DropDown List Items for ddlFunction
ddlFunction = New DropDownList
ddlFunction.AutoPostBack = True
ddlFunction.Items.Add(New ListItem("", "0"))
ddlFunction.Items.Add(New ListItem("NONE", "n"))
ddlFunction.Items.Add(New ListItem("ALWAYS", "a"))
ddlFunction.Items.Add(New ListItem("MULTIPLIER", "m"))
tr.Cells.Add(CreateDropDownListCell(ddlFunction, "ddlFunction" & strText, , 85, Css.Style.DefaultText))

'Create AddHandler for ddlFunction
AddHandler ddlFunction.SelectedIndexChanged, AddressOf ProcessDDLFunction
*******************************************************************
Problem I am running across is that when the DDL autopostback fires, it goes into the Page_Load and after it processs the LoadMain then it hits my AddHandler function.

The main thing that I am trying to accomplish is retrieve the ddlFunction control on the AutoPostBack. Because in my LoadMain I have code that needs to run to create another dynamic control on my form. In order for me to create the new dynmic control I need to know what the user selected in the ddlFunction dropdownlist. How can I retrieve this ddlFunction control's properties(ID,Value,Index,ect) back?

Thanks in advance for your help!

Adrian






From http://www.developmentnow.com/g/10_0_0_0_0_0/dotnet-framework-aspnet-buildingcontrols.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top