how to access a group of controls?

Discussion in 'ASP .Net' started by =?Utf-8?B?YzY3NjIyOA==?=, Jan 12, 2006.

  1. 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
     
    =?Utf-8?B?YzY3NjIyOA==?=, Jan 12, 2006
    #1
    1. Advertising

  2. 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
     
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Jan 12, 2006
    #2
    1. Advertising

  3. 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==?="
    <>
    | References: <>
    | Subject: RE: how to access a group of controls?
    | Date: Wed, 11 Jan 2006 17:28:03 -0800
    | Lines: 48
    | Message-ID: <>
    | 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
    |
     
    Steven Cheng[MSFT], Jan 12, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Akaketwa
    Replies:
    1
    Views:
    4,948
    impaler
    Sep 22, 2006
  2. Replies:
    0
    Views:
    548
  3. christopher taylor
    Replies:
    0
    Views:
    421
    christopher taylor
    Sep 17, 2008
  4. cpld-fpga-asic
    Replies:
    13
    Views:
    1,205
    rickman
    Jul 6, 2009
  5. Dag Sunde
    Replies:
    0
    Views:
    128
    Dag Sunde
    Nov 18, 2005
Loading...

Share This Page