[thelist] .NET multiple dynamically generated dropDownLists

Mark Joslyn Mark.Joslyn at SolimarSystems.com
Fri Sep 10 11:17:15 CDT 2004

I am creating a front-end web application that builds a search form to be
filled out by the user to return search results from a web services

Since the number of fields will vary form report to report, I need to
dynamically create the labels, textboxes and dropdownlists.

Here is how I am creating the form:

sub Page_Load(ByVal Sender as Object, ByVal e as EventArgs)
	' variables

		' web service connection code

		for each cc in bb.iInList
			Dim lbl as New Label()
			lbl.ID = "lbl_" & cc.inName.ToString
			Dim txt as New TextBox()		
			txt.ID = "txt_" & cc.inName.ToString
			txt.Width = Unit.Pixel(250)
			Dim ddlCon as New DropDownList()
			ddlCon.ID = "ddlCon_" & cc.inName.ToString
			ddlCon.AutoPostBack = true
			ddlCon.Width = Unit.Pixel(100)
			lbl.Text = cc.inName.ToString & ": "
'build table code (Table1)		
	catch ex As System.Web.Services.Protocols.SoapException
		' catch SOAP errors code
	end try
end sub

(FYI - this code is drastically trimmed)

What happens is that the table (Table1) is written out like this: this part
is working!

Cell1 = Label (lbl)
Cell2 = Contstructor (ddlCon)
Cell3 = Textbox (txt)
Cell4 = textbox (hidden)
end row

Next row, etc..

I need to be able to target a specific ddlCon - if a user selects "between"
from a ddlCon dropDownList, I need the Cell4 textbox to appear - but only
the Cell4 textbox in that row. Since all the dropDownLists are dynamically
generated, and have dynamically generated Ids, how can I assign specific
events to specific rows?

Any help would be appreciated.



More information about the thelist mailing list