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. Advertisements

  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. Advertisements

  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. Advertisements

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. Subba Rao via DotNetMonster.com

    script for moving rows up and down and traverse thru rows of HTML table

    Subba Rao via DotNetMonster.com, Mar 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    8,947
    Subba Rao via DotNetMonster.com
    Mar 19, 2005
  2. helpful sql
    Replies:
    0
    Views:
    1,067
    helpful sql
    May 19, 2005
  3. Arjen Hoekstra
    Replies:
    0
    Views:
    752
    Arjen Hoekstra
    Aug 2, 2005
  4. Jason James

    Rows the rows of a grid view?

    Jason James, Aug 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    602
    Jason James
    Aug 10, 2006
  5. Jeremy Jones

    Datagrid Nav buttons and numeric buttons

    Jeremy Jones, Mar 21, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    829
    Masudur
    Mar 22, 2007
  6. VijayRama
    Replies:
    2
    Views:
    2,656
    Gregory A. Beamer
    Oct 12, 2009
  7. Baburaj

    Access the buttons in the datagrid within another datagrid

    Baburaj, Mar 12, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    363
    Baburaj
    Mar 12, 2005
  8. MrMike

    Referencing Datagrid Rows while Datagrid is Sorted

    MrMike, May 20, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    283
    MrMike
    May 23, 2005
Loading...