[thelist] .NET multiple dynamically generated dropDownLists

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Fri Sep 10 11:42:16 CDT 2004


Mark,

	Do you want this to happen on the client or on postback?

http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ is another great
place to ask specialized ASP.NET questions like this.

Cheers,

Peter

-----Original Message-----
From: thelist-bounces at lists.evolt.org On Behalf Of Mark Joslyn

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

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

	try	
		' 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)		
		next
	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!

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

Thanks,

markJ



-- 

News! - Evolt.org conference for web professionals. 
17-19 September 2004 in Toronto, Canada. 
Details at http://TOevolt.org

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 





More information about the thelist mailing list