Results 1 to 2 of 2

Thread: Using a style sheet with a datagrid?

  1. #1

  2. #2
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Re: Using a style sheet with a datagrid?

    You can give styles for each item in the grid (ItemStyle), each alternating item (AlternatingItemStyle), the Header (HeaderStyle), the Footer (Footstyle), and for a selected item (SelectedItemStyle).

    HTML Code:
    <asp:datagrid id="dgrGrid" Runat="server">
        <SelectedItemStyle CssClass="datagridSelected"></SelectedItemStyle>
        <AlternatingItemStyle CssClass="datagridAlternate"></AlternatingItemStyle>
        <ItemStyle CssClass="datagridItem"></ItemStyle>
        <HeaderStyle CssClass="datagridHeader"></HeaderStyle>
        <FooterStyle CssClass="datagridFooter"></FooterStyle>
    
        <Columns></Columns>
    
    </asp:datagrid>
    And then in the CSS you can just add the elements.

    For example:

    Code:
    .datagridItem
    {
    	font-size: 12px;
    	color: black;
    	font-family: "Arial" , "Verdana" , "Tahoma";
    	background-color: #fefefe;
    	text-align: left;
    	height: 15px;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width