Datagrid HeaderStyle.CssClass applied to <tr>

Discussion in 'ASP .Net Web Controls' started by Randel, Feb 13, 2007.

  1. Randel

    Randel Guest

    Hi.

    I am building a datagrid based on a datatable. I am attempting to
    apply a style value using the syntax
    Datagrid.HeaderStyle.CssClass="mystyle".

    When the datagrid renders, the style is applied at the row level
    (example below)
    <tr class="mystyle" align="Left" valign="Top">
    <td>Name</td><td>City</td><td>Begin Date</td><td>Category</
    td><td>Calendar</td></tr>

    I need it to apply at the column level
    <tr align="Left" valign="Top">
    <td class="mystyle">Name</td><td class="mystyle">City</td><td
    class="mystyle">Begin Date</td><td class="mystyle">Category</td><td
    class="mystyle">Calendar</td></tr>

    I can't figure this out. Can you help?

    Thanks. Randy
    Randel, Feb 13, 2007
    #1
    1. Advertising

  2. Randel

    marss Guest

    Randel wrote:
    > Hi.
    >
    > I am building a datagrid based on a datatable. I am attempting to
    > apply a style value using the syntax
    > Datagrid.HeaderStyle.CssClass="mystyle".
    >
    > When the datagrid renders, the style is applied at the row level
    > (example below)
    > <tr class="mystyle" align="Left" valign="Top">
    > <td>Name</td><td>City</td><td>Begin Date</td><td>Category</
    > td><td>Calendar</td></tr>
    >
    > I need it to apply at the column level
    > <tr align="Left" valign="Top">
    > <td class="mystyle">Name</td><td class="mystyle">City</td><td
    > class="mystyle">Begin Date</td><td class="mystyle">Category</td><td
    > class="mystyle">Calendar</td></tr>
    >
    > I can't figure this out. Can you help?
    >
    > Thanks. Randy


    Hi,

    Add to stylesheet:
    ..mystyle td
    {
    //cell style properties
    }
    It applies to table cell.

    But the grid header usually renders as "<tr><th ..." and not
    "<tr><td ...". In this case use
    ..mystyle th
    {

    }
    marss, Feb 14, 2007
    #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. Mike

    Datagrid HeaderStyle

    Mike, Nov 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    482
  2. Drew
    Replies:
    1
    Views:
    497
  3. =?Utf-8?B?QmFyZW4=?=

    DataGrid Sort Column HeaderStyle

    =?Utf-8?B?QmFyZW4=?=, Apr 28, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    420
    =?Utf-8?B?QmFyZW4=?=
    Apr 28, 2005
  4. =?Utf-8?B?QmFyZW4=?=

    DataGrid Sort Column HeaderStyle

    =?Utf-8?B?QmFyZW4=?=, Apr 28, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    425
    =?Utf-8?B?QmFyZW4=?=
    Apr 28, 2005
  5. =?Utf-8?B?QmFyZW4=?=

    DataGrid Sort Column HeaderStyle

    =?Utf-8?B?QmFyZW4=?=, Apr 28, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    479
    =?Utf-8?B?QmFyZW4=?=
    Apr 28, 2005
Loading...

Share This Page