Re: Easy Question. asp:TextBox within an asp:Table

Discussion in 'ASP .Net' started by Teemu Keiski, Aug 21, 2003.

  1. Teemu Keiski

    Teemu Keiski Guest

    When you place TextBox inside <asp:table> you need to manually write the
    code-behind member declaration for the TextBox at class level. For example
    with "txtServiceName" provided in your sample.

    [VB]
    Protected WithEvents txtServiceName As System.Web.UI.WebControls.TextBox

    [C#]
    System.Web.UI.WebControls.TextBox txtServiceName;

    After you do this (be careful that member name matches control ID), you are
    done. Using this member you get the Intellisense as it then references the
    control on aspx.

    --
    Teemu Keiski
    MCP, Designer/Developer
    Mansoft tietotekniikka Oy
    http://www.mansoft.fi

    AspInsiders Member, www.aspinsiders.com
    ASP.NET Forums Moderator, www.asp.net
    AspAlliance Columnist, www.aspalliance.com

    "Matt M" <matt@remove_this_core49.com> wrote in message
    news:vc71b.795245$...
    > This shouldn't be too hard... but I'm having difficulty as I'm a bit of a
    > noob at .NET asp.
    >
    > So, I have a page that has an asp:Table with asp:TextBox 's in it. I need
    > the asp:Table so that I can set it's visibility based on a button click.

    I
    > am using the Codebehind model, and need some help.
    >
    > My problem is that in the codebehind page (service.aspx.cs), I cannot
    > reference the textbox values when I need them. I don't get intellisense

    on
    > them (however I do if I move the textboxes outside of the table). My
    > question is, how can I get the values of those boxes? It should be

    possible
    > right?
    >
    > Thanks for any help, (table below)
    >
    > - matt -
    > www.core49.com
    >
    >
    > So this is my table:
    >
    > <asp:table id="tbAdd" runat="server" EnableViewState="True"
    > Visible="False">
    > <asp:TableRow>
    > <asp:TableCell>
    > <asp:Label runat="server" Text="Name:" ID="Label1"></asp:Label>
    > <asp:TextBox runat="server" Text="" ID="txtServiceName"
    > MaxLength="50"></asp:TextBox>
    > </asp:TableCell>
    > <asp:TableCell>
    > <asp:Label runat="server" Text="Version:"

    ID="Label2"></asp:Label>
    > <asp:TextBox runat="server" Text="" ID="txtServiceVersion"
    > MaxLength="2" Width="20"></asp:TextBox>
    > </asp:TableCell>
    > <asp:TableCell ColumnSpan="2">
    > <asp:Label runat="server" Text="Description:"
    > ID="Label3"></asp:Label>
    > <asp:TextBox runat="server" Text="" ID="txtServiceDescription"
    > MaxLength="200"></asp:TextBox>
    > </asp:TableCell>
    > </asp:TableRow>
    > </asp:Table>
    >
    >
     
    Teemu Keiski, Aug 21, 2003
    #1
    1. Advertising

  2. Teemu Keiski

    Matt M Guest

    beautiful. Thanks a lot.


    "Teemu Keiski" <> wrote in message
    news:...
    > When you place TextBox inside <asp:table> you need to manually write the
    > code-behind member declaration for the TextBox at class level. For example
    > with "txtServiceName" provided in your sample.
    >
    > [VB]
    > Protected WithEvents txtServiceName As System.Web.UI.WebControls.TextBox
    >
    > [C#]
    > System.Web.UI.WebControls.TextBox txtServiceName;
    >
    > After you do this (be careful that member name matches control ID), you

    are
    > done. Using this member you get the Intellisense as it then references the
    > control on aspx.
    >
    > --
    > Teemu Keiski
    > MCP, Designer/Developer
    > Mansoft tietotekniikka Oy
    > http://www.mansoft.fi
    >
    > AspInsiders Member, www.aspinsiders.com
    > ASP.NET Forums Moderator, www.asp.net
    > AspAlliance Columnist, www.aspalliance.com
    >
    > "Matt M" <matt@remove_this_core49.com> wrote in message
    > news:vc71b.795245$...
    > > This shouldn't be too hard... but I'm having difficulty as I'm a bit of

    a
    > > noob at .NET asp.
    > >
    > > So, I have a page that has an asp:Table with asp:TextBox 's in it. I

    need
    > > the asp:Table so that I can set it's visibility based on a button click.

    > I
    > > am using the Codebehind model, and need some help.
    > >
    > > My problem is that in the codebehind page (service.aspx.cs), I cannot
    > > reference the textbox values when I need them. I don't get intellisense

    > on
    > > them (however I do if I move the textboxes outside of the table). My
    > > question is, how can I get the values of those boxes? It should be

    > possible
    > > right?
    > >
    > > Thanks for any help, (table below)
    > >
    > > - matt -
    > > www.core49.com
    > >
    > >
    > > So this is my table:
    > >
    > > <asp:table id="tbAdd" runat="server" EnableViewState="True"
    > > Visible="False">
    > > <asp:TableRow>
    > > <asp:TableCell>
    > > <asp:Label runat="server" Text="Name:" ID="Label1"></asp:Label>


    > > <asp:TextBox runat="server" Text="" ID="txtServiceName"
    > > MaxLength="50"></asp:TextBox>
    > > </asp:TableCell>
    > > <asp:TableCell>
    > > <asp:Label runat="server" Text="Version:"

    > ID="Label2"></asp:Label>
    > > <asp:TextBox runat="server" Text="" ID="txtServiceVersion"
    > > MaxLength="2" Width="20"></asp:TextBox>
    > > </asp:TableCell>
    > > <asp:TableCell ColumnSpan="2">
    > > <asp:Label runat="server" Text="Description:"
    > > ID="Label3"></asp:Label>
    > > <asp:TextBox runat="server" Text="" ID="txtServiceDescription"
    > > MaxLength="200"></asp:TextBox>
    > > </asp:TableCell>
    > > </asp:TableRow>
    > > </asp:Table>
    > >
    > >

    >
    >
     
    Matt M, Aug 21, 2003
    #2
    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. Hazzard
    Replies:
    2
    Views:
    669
    Hazzard
    Apr 6, 2004
  2. KatB
    Replies:
    0
    Views:
    458
  3. C_Kubie

    easy textbox question

    C_Kubie, Apr 28, 2006, in forum: Java
    Replies:
    2
    Views:
    362
    Venkatesh
    Apr 28, 2006
  4. Bruno Desthuilliers
    Replies:
    5
    Views:
    404
    Bruno Desthuilliers
    Aug 29, 2007
  5. =?Utf-8?B?QW5kcmV3IEhheWVz?=

    TextBox Within Table Wider Than Cell

    =?Utf-8?B?QW5kcmV3IEhheWVz?=, Sep 27, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    519
    Just Me
    Sep 28, 2007
Loading...

Share This Page