get textbox value in user control??

Discussion in 'ASP .Net' started by DaveF, Jan 11, 2005.

  1. DaveF

    DaveF Guest

    I have a textbox in a user control that a put in a aspx page. How do I get a
    referance to that textbox from my aspx page?

    --

    Dave
     
    DaveF, Jan 11, 2005
    #1
    1. Advertising

  2. DaveF

    Karl Seguin Guest

    Check out http://openmymind.net/communication/index.html it talks about
    some different strategies...the general idea is to expose the control (or
    atleast it's Text property) as a property of the control which the page can
    then access.

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "DaveF" <> wrote in message
    news:ulZisY$...
    > I have a textbox in a user control that a put in a aspx page. How do I get

    a
    > referance to that textbox from my aspx page?
    >
    > --
    >
    > Dave
    >
    >
     
    Karl Seguin, Jan 11, 2005
    #2
    1. Advertising

  3. DaveF

    Curt_C [MVP] Guest

    foreach (RepeaterItem ri in this.rptrCustomFields.Items)

    {

    TextBox txtRepeater = (TextBox)ri.FindControl("txtRepeater");

    }




    --
    Curt Christianson
    Site & Scripts: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "DaveF" <> wrote in message
    news:ulZisY$...
    >I have a textbox in a user control that a put in a aspx page. How do I get
    >a
    > referance to that textbox from my aspx page?
    >
    > --
    >
    > Dave
    >
    >
     
    Curt_C [MVP], Jan 11, 2005
    #3
  4. DaveF

    Karl Seguin Guest

    He didn't say anything about repeaters...though obviously the same could be
    applied to a user control (though it's a little different) :p

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:O5rUVp$...
    > foreach (RepeaterItem ri in this.rptrCustomFields.Items)
    >
    > {
    >
    > TextBox txtRepeater = (TextBox)ri.FindControl("txtRepeater");
    >
    > }
    >
    >
    >
    >
    > --
    > Curt Christianson
    > Site & Scripts: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "DaveF" <> wrote in message
    > news:ulZisY$...
    > >I have a textbox in a user control that a put in a aspx page. How do I

    get
    > >a
    > > referance to that textbox from my aspx page?
    > >
    > > --
    > >
    > > Dave
    > >
    > >

    >
    >
     
    Karl Seguin, Jan 11, 2005
    #4
  5. DaveF

    Curt_C [MVP] Guest

    DOH.....
    My bad, misread it.

    Otherwise just put the code for it IN the code-behind of the repeater.
    I use the same one you mentioned, expose it as public.

    --
    Curt Christianson
    Site & Scripts: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    wrote in message news:%23qr1Tx$...
    > He didn't say anything about repeaters...though obviously the same could
    > be
    > applied to a user control (though it's a little different) :p
    >
    > Karl
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > news:O5rUVp$...
    >> foreach (RepeaterItem ri in this.rptrCustomFields.Items)
    >>
    >> {
    >>
    >> TextBox txtRepeater = (TextBox)ri.FindControl("txtRepeater");
    >>
    >> }
    >>
    >>
    >>
    >>
    >> --
    >> Curt Christianson
    >> Site & Scripts: http://www.Darkfalz.com
    >> Blog: http://blog.Darkfalz.com
    >>
    >>
    >> "DaveF" <> wrote in message
    >> news:ulZisY$...
    >> >I have a textbox in a user control that a put in a aspx page. How do I

    > get
    >> >a
    >> > referance to that textbox from my aspx page?
    >> >
    >> > --
    >> >
    >> > Dave
    >> >
    >> >

    >>
    >>

    >
    >
     
    Curt_C [MVP], Jan 11, 2005
    #5
  6. DaveF

    Gengen

    Joined:
    Jul 6, 2007
    Messages:
    2
    Question about the repeater

    I have a radiobuttonlist I'm repeating and I need to know if I can get the values they select (1-10 for a survey)? Using c# looks like this:

    Code:
        protected void submit_Click(object sender, EventArgs e)
        {
            foreach (RepeaterItem riRating in this.Questions.Items)
            {
                RadioButtonList rating = (RadioButtonList)riRating.FindControl("rbList");
                Label1.Text += rating.SelectedIndex.ToString() + "</br>";
            }
            
        }
    
    ASP:

    Code:
     <asp:Repeater ID ="Questions" runat="server">
                <ItemTemplate>
                    <table>
                        <tr style ="border-bottom-color:black">
                            <td colspan="3" style="height: 20px">
                                <asp:Label ID="Label1" runat="server"></asp:Label>
                                <b><%# DataBinder.Eval(Container.DataItem, "Question")%>
                                   </b>
                                </td>
                        </tr>
                        <tr>
                            <td style="width: 63px; height: 20px">
                                Not Good</td>
                            <td style="width: 22px; height: 20px">
                                <asp:RadioButtonList ID="rbList" runat="server" AutoPostBack="False" BorderStyle="none"
                                    Height="34px" 
                                    RepeatDirection="Horizontal" Width="44px ">
                                    <asp:ListItem Value="1"></asp:ListItem>
                                    <asp:ListItem Value="2"></asp:ListItem>
                                    <asp:ListItem Value="3"></asp:ListItem>
                                    <asp:ListItem Value="4"></asp:ListItem>
                                    <asp:ListItem Value="5"></asp:ListItem>
                                    <asp:ListItem Value="6"></asp:ListItem>
                                    <asp:ListItem Value="7"></asp:ListItem>
                                    <asp:ListItem Value="8"></asp:ListItem>
                                    <asp:ListItem Value="9"></asp:ListItem>
                                    <asp:ListItem Value="10"></asp:ListItem>
                                </asp:RadioButtonList></td>
                            <td style="width: 45px; height: 20px">
                                Excellent</td><br />
                            <td style="width: 45px; height: 20px"><br />
                            <asp:Label ID="lblAnswer" runat="server" Visible="true" Text=""></asp:Label></td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:Repeater>
        &nbsp;<asp:Button ID="submit" Text="Submit" runat="server" OnClick="submit_Click"/>
        <br />
        <asp:Label ID="Label1" runat="server"></asp:Label>
    

    rbList is the ID for the actual radiobuttonlist and not the repeater. Any ideas? Help would be greatly appreciated.
     
    Gengen, Jul 6, 2007
    #6
    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. S. Justin Gengo
    Replies:
    0
    Views:
    578
    S. Justin Gengo
    Jul 16, 2003
  2. Chumley the Walrus
    Replies:
    3
    Views:
    4,689
  3. AGSHAR
    Replies:
    1
    Views:
    610
    AGSHAR
    May 31, 2008
  4. ErwinP
    Replies:
    1
    Views:
    820
    ErwinP
    Aug 19, 2005
  5. Steve
    Replies:
    4
    Views:
    240
    Steve
    Feb 7, 2006
Loading...

Share This Page