How to specify ROW properties in a datagrid

Discussion in 'ASP .Net Datagrid Control' started by Jørn A, Apr 28, 2004.

  1. Jørn A

    Jørn A Guest

    Customizing a datagrid is as you probably all know done by defining the
    different columns.
    But is it possible to specify properties for the ROWS in the datagrid?
    I would like to make a hyperlink that spans each complete row in the grid.
    I would also like to define a CSSClass for the TR HTML-tags written by the
    datagrid.
    Can this be done?

    -Jørn A.
     
    Jørn A, Apr 28, 2004
    #1
    1. Advertising

  2. Jørn A

    Amar Guest

    You Should override OnItemCreated

    protected override void OnItemCreated(DataGridItemEventArgs e) {
    if (e.Item.ItemType == ListItemType.Item ||
    e.Item.ItemType == ListItemType.AlternatingItem){
    e.Item.Attributes["class"] = "TRClass"; (Your Class Name)
    }
    }

    by the same way you can add any javascript code you want at each row,
    by using Atrtibutes

    "Jørn A" <> wrote in message news:<>...
    > Customizing a datagrid is as you probably all know done by defining the
    > different columns.
    > But is it possible to specify properties for the ROWS in the datagrid?
    > I would like to make a hyperlink that spans each complete row in the grid.
    > I would also like to define a CSSClass for the TR HTML-tags written by the
    > datagrid.
    > Can this be done?
    >
    > -Jørn A.
     
    Amar, Apr 28, 2004
    #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. Craig
    Replies:
    2
    Views:
    2,889
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Nov 2, 2004
  2. =?Utf-8?B?RGFiYmxlcg==?=

    specify row to edit when opening formview from gridview?

    =?Utf-8?B?RGFiYmxlcg==?=, Mar 22, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    7,599
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Mar 23, 2006
  3. Brett Sheeran
    Replies:
    0
    Views:
    2,939
    Brett Sheeran
    Jul 15, 2003
  4. Justin Dutoit
    Replies:
    1
    Views:
    1,862
    Anthony Jones
    Feb 17, 2009
  5. D
    Replies:
    0
    Views:
    230
Loading...

Share This Page