RadGrid for ASP.NET

RadGrid Send comments on this topic.
ItemStyle Property
See Also  Example
Telerik.WebControls Namespace > RadGrid Class : ItemStyle Property


Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the data items in a RadGrid control.   

 

Namespace: Telerik.WebControls
Assembly: RadGrid (in RadGrid.dll)

Syntax

Visual Basic (Declaration) 
Public Overridable ReadOnly Property ItemStyle As GridTableItemStyle
Visual Basic (Usage)Copy Code
Dim instance As RadGrid
Dim value As GridTableItemStyle
 
value = instance.ItemStyle
C# 
public virtual GridTableItemStyle ItemStyle {get;}

Return Value

A reference to the GridTableItemStyle that represents the style of the data items in a Telerik RadGrid control.

Example

Visual BasicCopy Code
<%@ Page language="VB" %>

<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>

<!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
  <head id="Head1" runat="server">
    <title>GridView ItemStyle And AlternatingItemStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <h3>GridView ItemStyle And AlternatingItemStyle Example</h3>

      <rad:RadGrid id="CustomersGridView"
        datasourceid="CustomersSource"
        autogeneratecolumns="true"
        Skin="None"
        runat="server">

        <itemstyle backcolor="LightCyan"
           forecolor="DarkBlue"
           font-italic="true"/>

        <alternatingitemstyle backcolor="PaleTurquoise"
          forecolor="DarkBlue"
          font-italic="true"/>

      </rad:RadGrid>

      <!-- This example uses Microsoft SQL Server And connects -->
      <!-- To the Northwind sample database. Use an ASP.NET -->
      <!-- expression To retrieve the connection String value -->
      <!-- from the Web.config file. -->
      <asp:sqldatasource id="CustomersSource"
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        connectionstring="<<see cref="NorthWindConnectionString">$ ConnectionStrings</see>>"
        runat="server"/>

    
  </body>
</html>

Remarks

Use the ItemStyle property to control the appearance of the data items in a Telerik RadGrid control. When the AlternatingItemStyle property is also set, the data items are displayed alternating between the ItemStyle settings and the AlternatingItemStyle settings. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns.

Requirements

Supported in: 3.0, 2.0, 1.1, 1.0 .NET Framework

See Also