Add TextBox to GridView

Discussion in 'ASP .Net' started by Gabriel, Aug 20, 2006.

  1. Gabriel

    Gabriel Guest

    Hello,

    Is there a way to add a Textbox to a GridView ? I'd like one TextBox by
    record.

    Thanks,
     
    Gabriel, Aug 20, 2006
    #1
    1. Advertising

  2. By "adding" a textbox, I assume you are referring to allow inserting of
    records (i.e. an Add interface to a Gridview?) Or are you talking about
    the fields that appear when you click Edit? Could you be more specific?

    If this is for insert then these should help you,

    http://geekswithblogs.net/casualjim/articles/51360.aspx

    http://geekswithblogs.net/casualjim/archive/2006/05/04/77151.aspx

    Gabriel wrote:
    > Hello,
    >
    > Is there a way to add a Textbox to a GridView ? I'd like one TextBox by
    > record.
    >
    > Thanks,
     
    Sarat Pediredla, Aug 20, 2006
    #2
    1. Advertising

  3. Gabriel

    Gabriel Guest


    > By "adding" a textbox, I assume you are referring to allow inserting of
    > records (i.e. an Add interface to a Gridview?) Or are you talking about
    > the fields that appear when you click Edit? Could you be more specific?


    In fact for each record, I'd like add a TextBox. When I display the grid the
    all textbox are empty, I add something in manually. I have a ButtonField to,
    when I click on it in the event RowCommand, I'd like recover the value of
    the textbox.

    Add the Textbox ok :
    <asp:TemplateField HeaderText="Qty">
    <ItemTemplate>
    <asp:TextBox ID="tbQty" runat="server" Width="25px"
    MaxLength="3" />
    </ItemTemplate>
    <ItemStyle Width="25px" HorizontalAlign="Center"/>
    </asp:TemplateField>

    That's work, the last problem if recover the value from the RowCommand
    event.

    Thanks,
     
    Gabriel, Aug 20, 2006
    #3
  4. Gabriel,

    To get to the textbox inside a Gridview, you need to use FindControl to
    find the textbox inside a control and cast it to TextBox.

    Hope this helps,

    http://www.codeproject.com/dotnet/AccessingControlsInsideGr.asp


    Gabriel wrote:
    > > By "adding" a textbox, I assume you are referring to allow inserting of
    > > records (i.e. an Add interface to a Gridview?) Or are you talking about
    > > the fields that appear when you click Edit? Could you be more specific?

    >
    > In fact for each record, I'd like add a TextBox. When I display the grid the
    > all textbox are empty, I add something in manually. I have a ButtonField to,
    > when I click on it in the event RowCommand, I'd like recover the value of
    > the textbox.
    >
    > Add the Textbox ok :
    > <asp:TemplateField HeaderText="Qty">
    > <ItemTemplate>
    > <asp:TextBox ID="tbQty" runat="server" Width="25px"
    > MaxLength="3" />
    > </ItemTemplate>
    > <ItemStyle Width="25px" HorizontalAlign="Center"/>
    > </asp:TemplateField>
    >
    > That's work, the last problem if recover the value from the RowCommand
    > event.
    >
    > Thanks,
     
    Sarat Pediredla, Aug 20, 2006
    #4
  5. Gabriel

    dharric

    Joined:
    Oct 24, 2006
    Messages:
    2
    Textbox.text property inside detailsview returns empty

    When I use findcontrol to get back my textbox I am able to retrieve the object, but my text property always comes back as empty, not null just empty. Any ideas?
     
    dharric, Oct 24, 2006
    #5
    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:
    581
    S. Justin Gengo
    Jul 16, 2003
  2. Hazzard
    Replies:
    2
    Views:
    590
    Yan-Hong Huang[MSFT]
    Jul 23, 2003
  3. Natty Gur
    Replies:
    0
    Views:
    498
    Natty Gur
    Jul 22, 2003
  4. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    18,046
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  5. Elmo Watson
    Replies:
    0
    Views:
    2,807
    Elmo Watson
    Aug 17, 2006
Loading...

Share This Page