DataGrid with buttons in rows

Discussion in 'ASP .Net Datagrid Control' started by John Smith Jr., Dec 13, 2003.

  1. I was wondering if this was possible, how does one place buttons or any
    other control in a row of a datagrid (each row actually).

    I even tried using DataGrid.Controls.Add() just to see where it would go
    (column?) but i didn't see anything when I tried this.
    John Smith Jr., Dec 13, 2003
    #1
    1. Advertising

  2. John Smith Jr.

    rmkhan Guest

    Hi John

    You can use template columns in dataGrid to add any control in row of datagrid

    Syntax :

    <asp:TemplateColumn HeaderText="Name">
    <ItemTemplate>
    <asp:Label id=lblName runat="server" Text='<%# DataBinder.Eval
    (Container, "DataItem.Name") %>'></asp:Label>
    </ItemTemplate>
    <FooterTemplate>
    <asp:TextBox id=txtNameAdd runat="server" Text='<%# DataBinder.Eval
    (Container, "DataItem.Name") %>'></asp:TextBox>
    </FooterTemplate>
    <EditItemTemplate>
    <asp:TextBox id=txtNameEdit runat="server" Text='<%#
    DataBinder.EvalContainer, "DataItem.Name") %>'></asp:TextBox>
    </EditItemTemplate>
    </asp:TemplateColumn>

    Bye
    Rehan Mustafa Khan

    "John Smith Jr." <> wrote in message news:<>...
    > I was wondering if this was possible, how does one place buttons or any
    > other control in a row of a datagrid (each row actually).
    >
    > I even tried using DataGrid.Controls.Add() just to see where it would go
    > (column?) but i didn't see anything when I tried this.
    rmkhan, Dec 16, 2003
    #2
    1. Advertising

  3. John Smith Jr.

    Paul Guest

    Take a look at the Columns collection in the Designer mode for the grid.
    You can add template columns, or you can add Button columns, etc., which
    will put controls on every row. In order to put bound controls into a
    template column you will need to do a lot more reading on that subject.
    Try 4GuysFromRolla who have put up a great series of articles on the
    datagrid. Also, DataGridGirl has a website with lots of articles.

    Button columns and EditCommand columns are easier to deal.





    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Paul, Dec 16, 2003
    #3
  4. Hi John
    You can use Template columns

    ----- John Smith Jr. wrote: -----

    I was wondering if this was possible, how does one place buttons or any
    other control in a row of a datagrid (each row actually).

    I even tried using DataGrid.Controls.Add() just to see where it would go
    (column?) but i didn't see anything when I tried this.
    Rehan Mustafa Khan_MSFT, Dec 22, 2003
    #4
    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. Roger
    Replies:
    1
    Views:
    616
    GreggTB
    May 20, 2005
  2. =?Utf-8?B?QmVu?=

    Image Buttons/Buttons not responding

    =?Utf-8?B?QmVu?=, Jul 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    433
    Teemu Keiski
    Jul 6, 2005
  3. Jeremy Jones

    Datagrid Nav buttons and numeric buttons

    Jeremy Jones, Mar 21, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    603
    Masudur
    Mar 22, 2007
  4. Jonathan N. Little
    Replies:
    3
    Views:
    515
    Andy Dingley
    Apr 2, 2007
  5. Dr. Leff
    Replies:
    3
    Views:
    281
    David Mark
    Oct 15, 2007
Loading...

Share This Page