Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 30th, 2005, 01:31 PM
Registered User
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Finding Dynamic controls

HI, I am adding many dynamic controls to a web form in the Initialization event. Later in the Page Load event I want to populate those controls. And on PostBacks I need to read those controls. I give each control a unique ID as it is added. How do I directly access the properties and methods of those controls? I can use nested “For Each” loops with testing to determine the controls ID but this is very messy. If I know the control ID I want to access, how do I get to its properties?
Here is the example. I have a Placeholder(ID = plc1) on a web form. In that place holder is a Panel, the panel contains a Table, the Table has a rows, Each row has cells, and within a cell I want to access a Drop Down list with an ID of “ddl1”. I want to add items to ddl1 and later read the selected text.
Below is my best guess. What should it really be?

Dim ctl as DropDownList = me.plc1.findcontrol(“ddl1”)

ctl.additems("First Item")

strResult = ctl.text


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding Controls and Checking Boxes rstelma ASP.NET 1.0 and 1.1 Professional 1 October 30th, 2007 02:01 PM
Delete Dynamic Controls rhd110 General .NET 1 July 22nd, 2007 04:23 AM
dynamic controls - referencing keyops VB.NET 0 February 14th, 2006 03:50 PM
Finding child controls Hunter ASP.NET 1.0 and 1.1 Professional 4 October 27th, 2005 09:09 AM
Dynamic Controls tommyuk VB How-To 2 June 26th, 2003 12:54 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.