469,611 Members | 1,933 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,611 developers. It's quick & easy.

how to access a group of controls?

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
Jan 12 '06 #1
2 1291
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

Jan 12 '06 #2
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==?="
<Ph**************@webswapp.com>
| References: <98**********************************@microsoft.co m>
| Subject: RE: how to access a group of controls?
| Date: Wed, 11 Jan 2006 17:28:03 -0800
| Lines: 48
| Message-ID: <E8**********************************@microsoft.co m>
| 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
|

Jan 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Peter Frost | last post: by
42 posts views Thread by lauren quantrell | last post: by
9 posts views Thread by prakashwadhwani | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.