PC Review


Reply
Thread Tools Rate Thread

Add TextBox to GridView

 
 
Gabriel
Guest
Posts: n/a
 
      20th Aug 2006
Hello,

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

Thanks,


 
Reply With Quote
 
 
 
 
Sarat Pediredla
Guest
Posts: n/a
 
      20th Aug 2006
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/.../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,


 
Reply With Quote
 
Gabriel
Guest
Posts: n/a
 
      20th Aug 2006

> 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,




 
Reply With Quote
 
Sarat Pediredla
Guest
Posts: n/a
 
      20th Aug 2006
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/Ac...lsInsideGr.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,


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
always the same text in a textBox in a Gridview Andrea Microsoft ASP .NET 1 14th May 2008 01:24 PM
Can't see my textbox values in a GridView maflatoun@gmail.com Microsoft Dot NET 0 25th Jan 2007 09:31 PM
Can't see my textbox values in a GridView maflatoun@gmail.com Microsoft Dot NET 0 25th Jan 2007 09:31 PM
How to get the editable textbox value from GridView in my code-beh =?Utf-8?B?U0RSb3k=?= Microsoft ASP .NET 0 26th Apr 2006 08:01 PM
Gridview and Empty Textbox .net 2.0 paulmac106 Microsoft ASP .NET 1 9th Jan 2006 09:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:47 AM.