how to access a group of controls?

G

Guest

Hi,
I created a group of user controls in an aspx form.
which is as follow:

<body>
<form id="Form1" method="post" runat="server">
<SUBWAY:pEOPLEINFO id="Peopleinfo0" runat="server" Caption="Dependent
Information"></SUBWAY:pEOPLEINFO>
<p></p>
<SUBWAY:pEOPLEINFO id="Peopleinfo1" runat="server" Caption="Dependent
Information"></SUBWAY:pEOPLEINFO>
<p></p>
<SUBWAY:pEOPLEINFO id="Peopleinfo2" runat="server" Caption="Dependent
Information"></SUBWAY:pEOPLEINFO>
<p></p>
<SUBWAY:pEOPLEINFO id="Peopleinfo3" runat="server" Caption="Dependent
Information"></SUBWAY:pEOPLEINFO>
<p></p>
<SUBWAY:pEOPLEINFO id="Peopleinfo4" runat="server" Caption="Dependent
Information"></SUBWAY:pEOPLEINFO>
<p></p>
<SUBWAY:pEOPLEINFO id="Peopleinfo5" runat="server" Caption="Dependent
Information"></SUBWAY:pEOPLEINFO>
<p><asp:label id="Label1" style="Z-INDEX: 150; LEFT: 80px; POSITION:
absolute; TOP: 450px" runat="server">label</asp:label><asp:button
id="Submit1" style="Z-INDEX: 102; LEFT: 72px; POSITION: absolute; TOP: 420px"
onclick="button_click"
runat="server" Text="Submit"></asp:button></p>
</form>
</body>
But I don't know how to write efficient codes to collect data from this
group of user controls, maybe I created in a very silly way, can you give me
a hint?
Thanks.
 
G

Guest

Consider every control to be able to process the user input and commands by
either 1) handling its own events, or 2) raising an event per request for
action to be handled by the container class (the page).
 
S

Steven Cheng[MSFT]

Hi Betty,

As for accessing the Usercontrol's states in page code, you can consider
the suggestion I also posted in your another thread in this groups:

Subject: how to access user control in aspx file
Newsgroups: microsoft.public.dotnet.framework.aspnet

We can programmatically access them like:
(check the control's type to see whether they're of the expected
usercontrol's type):
=====================
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim form1 As HtmlForm = Page.FindControl("form1")


Dim ctrl As Control

For Each ctrl In form1.Controls
Response.Write("<br>" & ctrl.GetType().ToString())
Next
End Sub
======================

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| Thread-Topic: how to access a group of controls?
| thread-index: AcYXF25iFyBvK4YyTVeTI9DD4bvaqw==
| X-WBNR-Posting-Host: 64.253.156.46
| From: "=?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?="
<[email protected]>
| References: <[email protected]>
| Subject: RE: how to access a group of controls?
| Date: Wed, 11 Jan 2006 17:28:03 -0800
| Lines: 48
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:370230
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Consider every control to be able to process the user input and commands
by
| either 1) handling its own events, or 2) raising an event per request for
| action to be handled by the container class (the page).
| --
| HTH,
| Phillip Williams
| http://www.societopia.net
| http://www.webswapp.com
|
|
| "c676228" wrote:
|
| > Hi,
| > I created a group of user controls in an aspx form.
| > which is as follow:
| >
| > <body>
| > <form id="Form1" method="post" runat="server">
| > <SUBWAY:pEOPLEINFO id="Peopleinfo0" runat="server"
Caption="Dependent
| > Information"></SUBWAY:pEOPLEINFO>
| > <p></p>
| > <SUBWAY:pEOPLEINFO id="Peopleinfo1" runat="server"
Caption="Dependent
| > Information"></SUBWAY:pEOPLEINFO>
| > <p></p>
| > <SUBWAY:pEOPLEINFO id="Peopleinfo2" runat="server"
Caption="Dependent
| > Information"></SUBWAY:pEOPLEINFO>
| > <p></p>
| > <SUBWAY:pEOPLEINFO id="Peopleinfo3" runat="server"
Caption="Dependent
| > Information"></SUBWAY:pEOPLEINFO>
| > <p></p>
| > <SUBWAY:pEOPLEINFO id="Peopleinfo4" runat="server"
Caption="Dependent
| > Information"></SUBWAY:pEOPLEINFO>
| > <p></p>
| > <SUBWAY:pEOPLEINFO id="Peopleinfo5" runat="server"
Caption="Dependent
| > Information"></SUBWAY:pEOPLEINFO>
| > <p><asp:label id="Label1" style="Z-INDEX: 150; LEFT: 80px; POSITION:
| > absolute; TOP: 450px" runat="server">label</asp:label><asp:button
| > id="Submit1" style="Z-INDEX: 102; LEFT: 72px; POSITION: absolute; TOP:
420px"
| > onclick="button_click"
| > runat="server" Text="Submit"></asp:button></p>
| > </form>
| > </body>
| > But I don't know how to write efficient codes to collect data from this
| > group of user controls, maybe I created in a very silly way, can you
give me
| > a hint?
| > Thanks.
| > --
| > Betty
|
 

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,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top