New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

RadGrid

Class

RadGrid control class.

Set properties of RadGrid as default for the corresponding properties of grid's table views GridTableView. The best approach to bind RadGrid is to handle its NeedDataSource event and set the DataSource property there. This way RadGrid will handle automatically operations like paging, sorting, grouping, etc. The main table-view can be accessed through MasterTableView property. The group panel and its items can be accessed using GroupPanel property. Note that the group items can be modified only through the GroupByExpressions properties of each GridTableView. Hierarchical grid structure can be implemented adding GridTableView objects to DetailTables and handling DetailTableDataBind event, where you should set the DataSource of each bound detail table filtered according to the ParentItem property key values. The Columns of RadGrid property is a reference to the columns of the MasterTableView and is present in RadGrid for compatibility with the DataGrid server control.

You can find more information on the server properties and events of RadGrid at the Server-Side Programming Overview article here: .

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[EmbeddedSkin("Grid")]
[EmbeddedSkin("Grid", "Default")]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadGrid))]
[RequiredCss("Telerik.Web.UI.Skins.Common.common.css", RenderMode.Lightweight, typeof(RadGrid))]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Mobile, typeof(RadGrid))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadGrid))]
[ControlValueProperty("SelectedValue")]
[ClientScriptResource("Telerik.Web.UI.RadGrid", "Telerik.Web.UI.Grid.RadGridScripts.js")]
[RequiredScript(typeof(MaterialRipple))]
[ToolboxBitmap(typeof(RadGrid), "Toolbox.Icons.Grid.png")]
[TelerikToolboxCategory("Data")]
public class RadGrid : GridBaseDataList, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, ISkinnableControl, IControl, IFeatureGroup, INamingContainer, IPostBackDataHandler, IPostBackEventHandler, ICallbackEventHandler

Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlCompositeDataBoundControlRadCompositeDataBoundControlGridBaseDataListRadGrid...

Implements: IAttributeAccessorICallbackEventHandlerIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorIFeatureGroupINamingContainerIParserAccessorIPostBackDataHandlerIPostBackEventHandlerIScriptControlISkinnableControlIUrlResolutionService...

Inherited Members GridBaseDataList.ControlStateGridBaseDataList.AddParsedSubObject(object)GridBaseDataList.SaveControlState()GridBaseDataList.LoadControlState(object)GridBaseDataList.OnSelectedIndexChanged(EventArgs)GridBaseDataList.OnSelectedCellChanged(EventArgs)GridBaseDataList.Render(HtmlTextWriter)GridBaseDataList.CreateControlStyle()GridBaseDataList.TabIndexGridBaseDataList.CellPaddingGridBaseDataList.CellSpacingGridBaseDataList.GridLinesGridBaseDataList.HorizontalAlignGridBaseDataList.SelectedIndexChangedGridBaseDataList.SelectedCellChangedCompositeDataBoundControl.CreateChildControls()CompositeDataBoundControl.PerformDataBinding(IEnumerable)CompositeDataBoundControl.IsUsingModelBindersCompositeDataBoundControl.ControlsDataBoundControl.OnCreatingModelDataSource(CreatingModelDataSourceEventArgs)DataBoundControl.CreateDataSourceSelectArguments()DataBoundControl.GetDataSource()DataBoundControl.MarkAsDataBound()DataBoundControl.OnDataPropertyChanged()DataBoundControl.OnPagePreLoad(object, EventArgs)DataBoundControl.PerformSelect()DataBoundControl.ValidateDataSource(object)DataBoundControl.ItemTypeDataBoundControl.DataSourceObjectDataBoundControl.SelectArgumentsDataBoundControl.CreatingModelDataSourceDataBoundControl.CallingDataMethodsBaseDataBoundControl.ConfirmInitState()BaseDataBoundControl.EnsureDataBound()BaseDataBoundControl.OnPreRender(EventArgs)BaseDataBoundControl.InitializedBaseDataBoundControl.IsBoundUsingDataSourceIDBaseDataBoundControl.IsDataBindingAutomaticBaseDataBoundControl.SupportsDisabledAttributeBaseDataBoundControl.RequiresDataBindingBaseDataBoundControl.DataBoundWebControl.AddAttributesToRender(HtmlTextWriter)WebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.MergeStyle(Style)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.AccessKeyWebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.CssClassWebControl.DisabledCssClassWebControl.StyleWebControl.EnabledWebControl.EnableThemingWebControl.FontWebControl.ForeColorWebControl.HasAttributesWebControl.HeightWebControl.IsEnabledWebControl.SkinIDWebControl.TagKeyWebControl.TagNameWebControl.ToolTipControl.ResolveAdapter()Control.HasEvents()Control.GetRouteUrl(object)Control.GetRouteUrl(string, object)Control.GetRouteUrl(RouteValueDictionary)Control.GetRouteUrl(string, RouteValueDictionary)Control.GetUniqueIDRelativeTo(Control)Control.ApplyStyleSheetSkin(Page)Control.OnDataBinding(EventArgs)Control.DataBind(bool)Control.DataBindChildren()Control.EnsureID()Control.ClearChildState()Control.ClearChildControlState()Control.ClearChildViewState()Control.ClearEffectiveClientIDMode()Control.ClearCachedClientID()Control.Focus()Control.MapPathSecure(string)Control.OpenFile(string)Control.BuildProfileTree(string, bool)Control.RenderChildren(HtmlTextWriter)Control.RenderControl(HtmlTextWriter)Control.RenderControl(HtmlTextWriter, ControlAdapter)Control.OnUnload(EventArgs)Control.Dispose()Control.RaiseBubbleEvent(object, EventArgs)Control.AddedControl(Control, int)Control.CreateControlCollection()Control.ResolveUrl(string)Control.ResolveClientUrl(string)Control.FindControl(string)Control.FindControl(string, int)Control.GetDesignModeState()Control.HasControls()Control.IsLiteralContent()Control.EnsureChildControls()Control.RemovedControl(Control)Control.SetDesignModeState(IDictionary)Control.SetRenderMethodDelegate(RenderMethod)Control.ClientIDModeControl.ClientIDControl.ClientIDSeparatorControl.ContextControl.AdapterControl.DesignModeControl.EventsControl.IDControl.IsChildControlStateClearedControl.ViewStateModeControl.IsViewStateEnabledControl.NamingContainerControl.IdSeparatorControl.LoadViewStateByIDControl.PageControl.RenderingCompatibilityControl.TemplateControlControl.ParentControl.TemplateSourceDirectoryControl.AppRelativeTemplateSourceDirectoryControl.SiteControl.VisibleControl.UniqueIDControl.HasChildViewStateControl.ValidateRequestModeControl.ViewStateControl.ViewStateIgnoresCaseControl.ChildControlsCreatedControl.IsTrackingViewStateControl.DisposedControl.DataBindingControl.InitControl.LoadControl.PreRenderControl.Unloadobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

Constructs a new instance of RadGrid

C#
public RadGrid()

Fields

C#
public const string BatchEditCommandName = "BatchEdit"
C#
public const string CancelAllCommandName = "CancelAll"

Represents the Cancel command name. This field is read-only.

C#
public const string CancelCommandName = "Cancel"

Use the CancelCommandName field to represent the "Cancel" command name. This command cancels the edit operation and RadGrid returns to normal mode.

Example:
cs-api-definition
<radG:GridTemplateColumn UniqueName="TemplateColumn">
C#
public const string ClearFilterCommandName = "ClearFilter"
C#
public const string ClearSortCommandName = "ClearSort"

Represents the "Delete" command name. This field is read-only.

C#
public const string DeleteCommandName = "Delete"

Use the DeleteCommandName field to represent the "Delete" command name.

Example:
cs-api-definition
<radG:GridTemplateColumn UniqueName="TemplateColumn">

Represents the "DeleteSelected" command name. This field is read-only.

C#
public const string DeleteSelectedCommandName = "DeleteSelected"

Use the DeleteSelectedCommandName field to represent the "DeleteSelected" command name.

Example:
cs-api-definition
<CommandItemTemplate>
C#
public const string DeselectCommandName = "Deselect"

Represents the "DownloadAttachment" command name. This field is read-only.

C#
public const string DownloadAttachmentCommandName = "DownloadAttachment"

Use the DownloadAttachment field to represent the "DownloadAttachment" command name.

C#
public const string EditAllCommandName = "EditAll"

Represents the "Edit" command name. This field is read-only.

C#
public const string EditCommandName = "Edit"

Use the EditCommandName field to represent the "Edit" command name. This command enters RadGrid in edit mode.

Example:
cs-api-definition
<radG:GridTemplateColumn UniqueName="TemplateColumn">
C#
public const string EditSelectedCommandName = "EditSelected"
C#
public const string ExpandCollapseAllCommandName = "ExpandCollapseAll"
C#
public const string ExpandCollapseCommandName = "ExpandCollapse"
C#
public const string ExportToCsvCommandName = "ExportToCsv"
C#
public const string ExportToExcelCommandName = "ExportToExcel"
C#
public const string ExportToPdfCommandName = "ExportToPdf"
C#
public const string ExportToWordCommandName = "ExportToWord"
C#
public const string FilterCommandName = "Filter"
C#
public const string FirstPageCommandArgument = "First"
C#
public const string GroupsCustomExpandCollapseCommandName = "GroupsCustomExpandCollapse"
C#
public const string GroupsExpandAllCommandName = "GroupsExpandAll"

Represents the name of the filter command fired through RadGrid's header context menu.

C#
public const string HeaderContextMenuFilterCommandName = "HeaderContextMenuFilter"
C#
public const string HeaderSortCommandName = "HeaderSort"

Represents the "InitInsert" command name. This field is read-only.

C#
public const string InitInsertCommandName = "InitInsert"

Use the InitInsertCommandName field to represent the "InitInsert" command name. This command enters RadGrid in edit mode and lets the user enter the data for a new record.

Example:
cs-api-definition
<CommandItemTemplate>
C#
public const string LastPageCommandArgument = "Last"
C#
public const string NextPageCommandArgument = "Next"
C#
public const string PageCommandName = "Page"

Represents the "PerformInsert" command name. This field is read-only.

C#
public const string PerformInsertCommandName = "PerformInsert"

Use the PerformInsertCommandName field to represent the "PerformInsert" command name. This command enters the new record into the database.

C#
public const string PrevPageCommandArgument = "Prev"

Represents the "RebindGrid" command name. This field is read-only. Forces RadGrid.Rebind

C#
public const string RebindGridCommandName = "RebindGrid"

Use the RebindGridCommandName field to force rebinding the grid.

C#
public const string SelectCommandName = "Select"
C#
public const string SortCommandName = "Sort"

Represents the "Update" command name. This field is read-only.

C#
public const string UpdateCommandName = "Update"

Use the UpdateCommandName field to represent the "Update" command name.

Example:
cs-api-definition
<radG:GridTemplateColumn UniqueName="TemplateColumn">

Represents the "UpdateEdited" command name. Updates all items that are in edit mode. This field is read-only.

C#
public const string UpdateEditedCommandName = "UpdateEdited"

Use the UpdateCommandName field to represent the "Update" command name.

Example:
cs-api-definition
<CommandItemTemplate>

Properties

Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the active item in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle ActiveItemStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the actibe item in a Telerik RadGrid control.

Use the ActiveItemStyle property to control the appearance of the active item in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, ActiveItemStyle-ForeColor).
  • Nest a <ActiveItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, ActiveItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
The following code example demonstrates how to use the SelectedItemStyle property
to define a custom style for the active item in a Telerik RadGrid
control.

Gets or sets a value indicating whether Telerik RadGrid will automatically delete records from the specified data source.

C#
public bool AllowAutomaticDeletes { get; set; }
Property Value:

true, when automatic delete from the database would be performed; otherwise false. The default is false.

Gets or sets a value indicating whether Telerik RadGrid will perform automatic insert of records to the data source.

C#
public bool AllowAutomaticInserts { get; set; }
Property Value:

true, when automatic insert into the database would be performed; otherwise false. The default is false.

Gets or sets a value indicating whether Telerik RadGrid will perform automatic updates to the data source.

C#
public bool AllowAutomaticUpdates { get; set; }
Property Value:

true, when the automatic updates are allowed; otherwise false. The default is false.

Gets or sets a value indicating whether custom paging should be performed instead of the integrated automatic paging.

C#
public virtual bool AllowCustomPaging { get; set; }
Property Value:

true, if custom paging is allowed; otherwise false. The default is false.

This online example demonstrates an approach to implementing custom paging with Telerik RadGrid. The simulated "DataLayer" wraps the logic of extracting records for only the specified page and deleting records. Telerik RadGrid maintains the pager buttons, changing of pager and other presentation specific features.

Note: There is no universal mechanism for grouping when custom paging is allowed. The reason for this is that with the custom paging mechanism you fetch only part of the whole information from the grid datasource. Thus, when you trigger the grouping event the grid is restricted from operating with the whole available source data and is not able to group the items accurately. Furthermore, the aggregate functions as Count, Sum, etc. (covering operations with the whole set of grid items) will return incorrect results.

A workaround solution for you could be to use hierarchy in the grid instead of grouping to single out the grid items logically and visually according to custom criteria. Thus you will be able to use custom paging without further limitations.

Another approach is to build your own complex SQL statements which to get the whole available data from the grid datasource and then group the items in the grid with custom code logic.

Finally, you can use standard paging instead of custom paging to ensure the consistency of the data on grouping.

Gets or sets a value indicating whether the filtering of all tables in the hierarchy will be enabled, unless specified other by GridTableView.AllowFilteringByColumn.

C#
public virtual bool AllowFilteringByColumn { get; set; }
Property Value:

true, enables filtering for the whole grid. Otherwise, false. Default is false.

Gets or sets a value indicating whether Telerik RadGrid will allow you to have multiple rows in edit mode. The default value is false.

C#
public bool AllowMultiRowEdit { get; set; }
Property Value:

true if you can have more than one row in edit mode. Otherwise, false. The default value is false.

Gets or sets a value indicating whether you will be able to select multiple rows in Telerik RadGrid. By default this property is set to false.

C#
public bool AllowMultiRowSelection { get; set; }
Property Value:

true if you can have multiple rows selected at once. Otherwise, false. The default is false.

Note: You will not be able to select the Header, Footer or Pager rows.

Gets or sets a value indicating whether the automatic paging feature is enabled.

C#
public virtual bool AllowPaging { get; set; }
Property Value:

true if the paging feature is enabled; otherwise, false. The default is false

Instead of displaying all the records in the data source at the same time, the Telerik RadGrid control can automatically break the records up into pages. If the data source supports the paging capability, the Telerik RadGrid control can take advantage of that and provide built-in paging functionality. The paging feature can be used with any data source object that supports the System.Collections.ICollection interface or a data source that supports paging capability.

To enable the paging feature, set the AllowPaging property to true. By default, the Telerik RadGrid control displays 10 records on a page at a time. You can change the number of records displayed on a page by setting the PageSize property. To determine the total number of pages required to display the data source contents, use the PageCount property. You can determine the index of the currently displayed page by using the CurrentPageIndex property.

When paging is enabled, an additional item called the pager item is automatically displayed in the Telerik RadGrid control. The pager item contains controls that allow the user to navigate to the other pages. You can control the settings of the pager item by using the PagerItemStyle property. The pager item can be displayed at the top, bottom, or both the top and bottom of the control by setting the Position property. You can also select from one of four built-in pager display modes by setting the Mode property.

The Telerik RadGrid control also allows you to define a custom template for the pager item.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
AllowPaging="true" &gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;&lt;see cref="NorthwindConnectionString"&gt;$ ConnectionStrings&lt;/see&gt;&gt;"
SelectCommand="SELECT [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets a value indicating whether the sorting feature is enabled.

C#
public virtual bool AllowSorting { get; set; }
Property Value:

true if the sorting feature is enabled; otherwise, false. The default is false.

When a data source control that supports sorting is bound to the Telerik RadGrid control, the Telerik RadGrid control can take advantage of the data source control's capabilities and provide automatic sorting functionality.

To enable sorting, set the AllowSorting property to true. When sorting is enabled, the heading text for each column field with its SortExpression property set is displayed as a link button.

Clicking the link button for a column causes the items in the Telerik RadGrid control to be sorted based on the sort expression. Typically, the sort expression is simply the name of the field displayed in the column, which causes the Telerik RadGrid control to sort with respect to that column. To sort by multiple fields, use a sort expression that contains a comma-separated list of field names. You can determine the sort expression that the Telerik RadGrid control is applying by using the SortExpression property. Clicking a column's link button repeatedly toggles the sort direction between ascending and descending order.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
AllowSorting="true"&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

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

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle AlternatingItemStyle { get; }
Property Value:

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

Use the AlternatingItemStyle property to control the appearance of alternating data items in a Telerik RadGrid control. When this property is 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. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, AlternatingItemStyle-ForeColor).
  • Nest an <AlternatingItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, AlternatingItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
&lt;%@ Page language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html  &gt;
&lt;head id="Head1" runat="server"&gt;
&lt;title&gt;GridView ItemStyle and AlternatingItemStyle Example&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;h3&gt;GridView ItemStyle and AlternatingItemStyle Example&lt;/h3&gt;

&lt;radG:RadGrid id="CustomersGridView"
datasourceid="CustomersSource"
autogeneratecolumns="true"
Skin=""
runat="server"&gt;

&lt;itemstyle backcolor="LightCyan"
forecolor="DarkBlue"
font-italic="true"/&gt;

&lt;alternatingitemstyle backcolor="PaleTurquoise"
forecolor="DarkBlue"
font-italic="true"/&gt;

&lt;/radG:RadGrid&gt;

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

&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets a value indicating whether bound fields are automatically created for each field in the data source.

C#
public virtual bool AutoGenerateColumns { get; set; }
Property Value:

true to automatically create bound fields for each field in the data source; otherwise, false. The default is true.

When the AutoGenerateColumns property is set to true, an GridBoundColumn object is automatically created for each field in the data source. Each field is then displayed as a column in the Telerik RadGrid control in the order that the fields appear in the data source. This option provides a convenient way to display every field in the data source; however, you have limited control of how an automatically generated column field is displayed or behaves.

Runtime auto-generated columns will always appear after the user-specified columns, unless the columns are ordered programmatically.

Instead of letting the Telerik RadGrid control automatically generate the column fields, you can manually define the column fields by setting the AutoGenerateColumns property to false and then creating a custom Columns collection. In addition to bound column fields, you can also display a button column, a check box column, a button column, a hyperlink column, an image column, or a column based on your own custom-defined template etc.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
AutoGenerateColumns="true"
AllowSorting="true"&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;&lt;see cref="NorthwindConnectionString"&gt;$ ConnectionStrings&lt;/see&gt;&gt;"
SelectCommand="SELECT [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets a value determining if RadGrid will automatically generate a GridButtonColumn with CommandName set to 'Delete'.

C#
public virtual bool AutoGenerateDeleteColumn { get; set; }
Property Value:

A value determining if RadGrid will automatically generate a GridButtonColumn with CommandName set to 'Delete'.

Gets or sets a value determining if RadGrid will automatically generate a GridEditCommandColumn.

C#
public virtual bool AutoGenerateEditColumn { get; set; }
Property Value:

A value determining if RadGrid will automatically generate a GridEditCommandColumn.

Gets or sets a value indicating whether detail tables will be automatically created from the dataset object to which the grid is bound.

C#
public virtual bool AutoGenerateHierarchy { get; set; }

Gets or sets the URL to an image to display in the background of a Telerik RadGrid control.

C#
[Bindable(true)]
public virtual string BackImageUrl { get; set; }
Property Value:

The URL of an image to display in the background of the Telerik RadGrid control. The default is an empty string (""), which indicates that this property is not set.

Use the BackImageUrl property to specify the URL to an image to display in the background of a Telerik RadGrid control.

If the specified image is smaller than the Telerik RadGrid control, the image is tiled to fill in the background. If the image is larger than the control, the image is cropped.

Gets or sets ID of RadClientDataSource control that to be used for client side binding

C#
public virtual string ClientDataSourceID { get; set; }

Gets a reference to the GridClientSettings object that allows you to set the properties of the client-side behavior and appearance in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridClientSettings ClientSettings { get; }
Property Value:

A reference to the GridClientSettings that allows you to set the properties of the the client-side behavior and appearance in a Telerik RadGrid control.

Example:
C#
<p>Use the ClientSettings property to control the settings of the client-side
behavior and appearance in a Telerik RadGrid control. This property is
read-only; however, you can set the properties of the GridClientSettings object it
returns. The properties can be set declaratively using one of the following
methods:</p>
<ul><li>Place an attribute in the opening tag of the Telerik RadGrid
    control in the form Property-Subproperty, where Subproperty is a property of
    the GridClientSettings object (for example,
    ClientSettings-AllowDragToGroup).</li><li>Nest a &lt;ClientSettings&gt; element between the opening and closing
    tags of the Telerik RadGrid control.</li></ul>
<p>The properties can also be set programmatically in the form
Property.Subproperty (for example, SortingSettings.AllowDragToGroup). Common
settings usually include the behavior and appearance on the client-side.</p>

Gets a collection (GridColumnCollection) of all columns in Telerik RadGrid.

C#
[Browsable(false)]
public virtual GridColumnCollection Columns { get; }
Property Value:

returns a GridColumnCollection of all grid columns.

This is one of the three columns collections in Telerik RadGrid. The other two are AutoGeneratedColumns and RenderColumns.

Example:
cs-api-definition
&lt;
radG:RadGrid ID="RadGrid1" DataSourceID="AccessDataSource1" AllowPaging="True" ShowFooter="True"
runat="server" AutoGenerateColumns="False" AllowSorting="True" PageSize="3" Width="925px"
GridLines="None" CellPadding="0" Skin="Default" AllowMultiRowSelection="true"&gt;
&lt;MasterTableView ShowFooter="True"&gt;
&lt;RowIndicatorColumn Visible="False" UniqueName="RowIndicator"&gt;
&lt;HeaderStyle Width="20px"&gt;&lt;/
HeaderStyle&gt;
&lt;/RowIndicatorColumn
&gt;
&lt;Columns
&gt;
&lt;radG:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn"
HeaderText="Edit&amp;#160;Command Column"&gt;
&lt;/radG:GridEditCommandColumn
&gt;
&lt;radG:GridClientSelectColumn UniqueName="CheckboxSelectColumn" HeaderText="CheckboxSelect column &lt;br
/&gt;" /&gt;
&lt;radG:GridBoundColumn FooterText="BoundColumn footer" UniqueName="CustomerID" SortExpression="CustomerID"
HeaderText="Bound&lt;br/
&gt;Column" DataField="CustomerID"&gt;
&lt;/radG:GridBoundColumn
&gt;
&lt;radG:GridCheckBoxColumn FooterText="CheckBoxColumn footer" UniqueName="Bool" HeaderText="CheckBox&lt;
br/&gt;Column"
DataField="Bool"&gt;
&lt;/radG:GridCheckBoxColumn
&gt;
&lt;radG:GridDropDownColumn FooterText="DropDownColumn footer" UniqueName="DropDownListColumn"
ListTextField="ContactName" ListValueField="CustomerID" DataSourceID="AccessDataSource2"
HeaderText="DropDown&lt;
br/&gt;Column" DataField="CustomerID"&gt;
&lt;/radG:GridDropDownColumn
&gt;
&lt;radG:GridButtonColumn FooterText="PushButtonColumn&lt;
br/&gt;footer" DataTextFormatString="Select {0}"
ButtonType="PushButton" UniqueName="column" HeaderText="PushButton&lt;
br/&gt;Column"
CommandName="Select" DataTextField="CustomerID"&gt;
&lt;/radG:GridButtonColumn
&gt;
&lt;radG:GridButtonColumn FooterText="LinkButtonColumn footer" DataTextFormatString="Remove selection"
UniqueName="column1" HeaderText="LinkButton&lt;
br/&gt;Column" CommandName="Deselect"
DataTextField="CustomerID"&gt;
&lt;/radG:GridButtonColumn
&gt;
&lt;radG:GridHyperLinkColumn FooterText="HyperLinkColumn footer" DataTextFormatString="Search Google for '{0}'"
DataNavigateUrlField="CompanyName" UniqueName="CompanyName" DataNavigateUrlFormatString="http://www.google.com/search?hl=en&amp;amp;q={0}&amp;amp;btnG=Google+Search"
HeaderText="HyperLink&lt;
br/&gt;Column" DataTextField="CompanyName"&gt;
&lt;/radG:GridHyperLinkColumn
&gt;
&lt;radG:GridTemplateColumn UniqueName="TemplateColumn" SortExpression="CompanyName"&gt;
&lt;FooterTemplate
&gt;
&lt;img src="Img/image.gif" alt="" style="vertical-align: middle" /&gt;
Template footer
&lt;/FooterTemplate
&gt;
&lt;HeaderTemplate
&gt;
&lt;table id="Table1" cellspacing="0" cellpadding="0" width="300" border="1"&gt;
&lt;tr
&gt;
&lt;td colspan="2" align="center"&gt;
&lt;b
&gt;Contact details&lt;/b
&gt;&lt;/td
&gt;
&lt;/tr
&gt;
&lt;tr
&gt;
&lt;td style="width: 50%" align="center"&gt;
&lt;asp:LinkButton CssClass="Button" Width="140" ID="btnContName" Text="Contact name"
Tooltip="Sort by ContactName" CommandName='Sort' CommandArgument='ContactName' runat="server" /&gt;&lt;/td&gt;
&lt;td style="width: 50%" align="center"&gt;
&lt;asp:LinkButton CssClass="Button" Width="140" ID="btnContTitle" Text="Contact title"
Tooltip="Sort by ContactTitle" CommandName='Sort' CommandArgument='ContactTitle'
runat="server" /&gt;&lt;/td&gt;
&lt;/tr
&gt;
&lt;/table
&gt;
&lt;/HeaderTemplate
&gt;
&lt;ItemTemplate
&gt;
&lt;table cellpadding="1" cellspacing="1" class="customTable"&gt;
&lt;tr
&gt;
&lt;td style="width: 50%"&gt;
&lt;%#Eval("ContactName") %&gt;
&lt;/td
&gt;
&lt;td style="width: 50%"&gt;
&lt;%#Eval("ContactTitle") %&gt;
&lt;/td
&gt;
&lt;/tr
&gt;
&lt;tr
&gt;
&lt;td colspan="2" align="center"&gt;
&lt;a href='&lt;%#"http://www.google.com/search?hl=en&amp;amp;q=" + DataBinder.Eval(Container.DataItem, "ContactName") + "&amp;amp;btnG=Google+Search"%&gt;' &gt;
&lt;em
&gt;Search Google for
&lt;%#Eval("ContactName") %&gt;
&lt;/em
&gt;&lt;/a
&gt;
&lt;/td
&gt;
&lt;/tr
&gt;
&lt;tr
&gt;
&lt;td colspan="2" align="center"&gt;
&lt;img src="Img/image.gif" alt="" /&gt;
&lt;/td
&gt;
&lt;/tr
&gt;
&lt;/table
&gt;
&lt;/ItemTemplate
&gt;
&lt;/radG:GridTemplateColumn
&gt;
&lt;/Columns
&gt;
&lt;/MasterTableView
&gt;
&lt;ClientSettings
&gt;
&lt;Selecting AllowRowSelect="true" /&gt;
&lt;/ClientSettings
&gt;
&lt;/radG:RadGrid
&gt;

Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the command item in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle CommandItemStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the command item in a Telerik RadGrid control.

Use the CommandItemStyle property to control the appearance of the command item in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, CommandItemStyle-ForeColor).
  • Nest a <CommandItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, CommandItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
Skin=""&gt;
&lt;CommandItemStyle BackColor="red" /&gt;
&lt;MasterTableView CommandItemDisplay="TopAndBottom"&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets the selected culture. Localization strings will be loaded based on this value.

C#
public CultureInfo Culture { get; set; }
Property Value:

The selected culture. Localization strings will be loaded based on this value.

Gets or sets an integer value representing the current page index.

C#
[Bindable(true)]
[Browsable(false)]
public int CurrentPageIndex { get; set; }
Property Value:

zero-based int representing the index of the current page.

Note that the Paging must be enabled (AllowPaging must be true) in order to use this property.

Gets or sets the name of the list of data that the Telerik RadGrid control binds to, in cases where the data source contains more than one distinct list of data items.

C#
public override string DataMember { get; set; }
Property Value:

The name of the specific list of data that the Telerik RadGrid control binds to, if more than one list is supplied by a data source control. The default value is String.Empty.

Overrides: RadCompositeDataBoundControl.DataMember

Use the DataMember property to specify a member from a multimember data source to bind to the list control. For example, if you have a data source with more than one table specified in the DataSource property, use the DataMember property to specify which table to bind to a data listing control.

The value of the DataMember property is stored in view state.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and Themes and Skins Overview in MSDN.

Gets or sets a OData service DataModelID.

C#
public virtual string DataModelID { get; set; }
Property Value:

The OData service DataModelID.

Gets or sets the object from which the Telerik RadGrid control retrieves its list of data items.

C#
[Bindable(true)]
[Browsable(false)]
public override object DataSource { get; set; }
Property Value:

An object that represents the data source from which the Telerik RadGrid control retrieves its data. The default is a null reference (Nothing in Visual Basic).

Overrides: RadCompositeDataBoundControl.DataSource

You should have in mind, that in case you are using simple data binding (i.e. when you are not using NeedDataSource event) the correct approach is to call the DataBind() method on the first page load when !Page.IsPostBack and after handling some event (sort event for example).

You will need to assign DataSource and rebind the grid after each operation (paging, sorting, editing, etc.) - this copies exactly MS DataGrid behavior.

Example:
C#
The following code example demonstrates how the DataSource property of a
Telerik RadGrid control is used. In this example, the
Telerik RadGrid control is bound to a DataSet object. After the DataSource
property is set, the DataBind method is called explicitly.

Gets or sets the ID of the control from which the Telerik RadGrid control retrieves its list of data items.

C#
[Themeable(false)]
public override string DataSourceID { get; set; }
Property Value:

The ID of a control that represents the data source from which the Telerik RadGrid control retrieves its data. The default is String.Empty.

Overrides: RadCompositeDataBoundControl.DataSourceID

If the Telerik RadGrid control has already been initialized when you set the DataSourceID property.

This property cannot be set by themes or style sheet themes.

Example:
C#
&lt;%@ Page Language="VB" &lt;see cref="&gt; &lt;"/&gt;@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;


&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;&lt;see cref="NorthwindConnectionString"&gt;$ ConnectionStrings&lt;/see&gt;&gt;"
SelectCommand="SELECT [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets the name of the method to call in order to delete data

C#
public string DeleteMethod { get; set; }

Gets a collection of the indexes of the Items that are in edit mode.

C#
[Browsable(false)]
public GridIndexCollection EditIndexes { get; }
Property Value:

returns GridIndexCollection of all data items that are in edit mode.

Example:
cs-api-definition
&lt;CommandItemTemplate&gt;

Gets a collection of all GridItems in edit mode. See the Remarks for more info.

C#
[Browsable(false)]
public GridItemCollection EditItems { get; }
Property Value:

GridItemCollection of all items that are in edit mode.

The EditItems collection contains InPlace edit mode items. When you switch the edit type to EditForms, the EditItems collection holds the currently edited items but not their EditFormItems (which in this case hold the new values).

You should not use this property to check whether there are items in edit mode. The better approach is to use EditIndexes property instead.

Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the item selected for editing in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle EditItemStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the item being edited in a Telerik RadGrid control.

Use the EditItemStyle property to control the appearance of the item being edited in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, EditItemStyle-ForeColor).
  • Nest a <EditItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, EditItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
Skin="" &gt;
&lt;EditItemStyle BackColor="red" /&gt;
&lt;MasterTableView&gt;
&lt;Columns&gt;
&lt;radG:GridEditCommandColumn&gt;
&lt;/radG:GridEditCommandColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

When set to true enables support for WAI-ARIA

C#
public bool EnableAriaSupport { get; set; }

Gets or sets a value indicating whether the groups expand/collapse all header buttons should be switched on.

C#
public virtual bool EnableGroupsExpandAll { get; set; }
Property Value:

A value indicating whether the groups expand/collapse all header buttons should be switched on.

Gets or sets a value indicating whether the option to set columns aggregates should appear in header context menu.

C#
public virtual bool EnableHeaderContextAggregatesMenu { get; set; }
Property Value:

true if the set columns aggregates option is enabled; otherwise, false. Default is false.

Gets or sets a value indicating whether the header context filter menu should be enabled.

C#
public virtual bool EnableHeaderContextFilterMenu { get; set; }
Property Value:

true if the header context filter menu feature is enabled; otherwise, false. Default is false.

Gets or sets a value indicating whether the header context menu should be enabled.

C#
public virtual bool EnableHeaderContextMenu { get; set; }
Property Value:

true if the header context menu feature is enabled; otherwise, false. Default is false.

Gets or sets a value indicating whether the hierarchy expand/collapse all header buttons should be switched on.

C#
public virtual bool EnableHierarchyExpandAll { get; set; }
Property Value:

A value indicating whether the hierarchy expand/collapse all header buttons should be switched on.

Gets or sets a value indicating whether native LINQ expressions will be enabled.

C#
public virtual bool EnableLinqExpressions { get; set; }
Property Value:

true if the sorting LINQ expressions are enabled; otherwise, false. The default is true.

Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client.

C#
public override bool EnableViewState { get; set; }
Property Value:

true if the server control maintains its view state; otherwise false. The default is true.

Overrides: RadCompositeDataBoundControl.EnableViewState

Gets a reference to the GridExportSettings object that allows you to set the properties of the grouping operation in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridExportSettings ExportSettings { get; }
Property Value:

A reference to the GridExportSettings that allows you to set the properties of the grouping operation in a Telerik RadGrid control.

Use the ExportSettings property to control the settings of the grouping operations in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridGroupingSettings object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridExportSettings object (for example, GroupingSettings-ExpandTooltip).
  • Nest a <GroupingSettings> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, GroupingSettings.ExpandTooltip). Common settings usually include the tool tips for the sorting controls.

Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the filter item in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle FilterItemStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the filter item in a Telerik RadGrid control.

Use the FilterItemStyle property to control the appearance of the filter item in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, FilterItemStyle-ForeColor).
  • Nest a <FilterItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, FilterItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
Skin=""
AllowFilteringByColumn="true"&gt;
&lt;FilterItemStyle BackColor="red" /&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets a reference to GridFilterMenu object. The filtering menu appears when the filter button on the GridFilteringItem is clicked.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridFilterMenu FilterMenu { get; }
Property Value:

returns a reference to GridFilterMenu object.

This property is meaningful only when you have filtering enabled (by setting AllowFilteringByColumn="true").

Example:
C#
<p>The following example demonstrates how to customize the filtering
menu:</p>
<p><font face="Courier New"><strong>[ASPX/ASCX]<br /></strong>&lt;head
runat=<font class="string" color="black">"server"</font>&gt;<br />
 &lt;title&gt;Filter menu change&lt;/title&gt;<br />
 &lt;style type=<font class="string" color="black">"text/css"</font>&gt;<br />
 .FilterMenuClass1 td<br />
 {<br />
 background-color: white;<br />
 color: green;<br />
 font-size: 10px;<br />
 }<br />
 .FilterMenuClass2 td<br />
 {<br />
 background-color: blue;<br />
 color: white;<br />
 font-size: 15px;<br />
 }<br />
 &lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
 &lt;form id=<font class="string" color="black">"form1"</font>
runat=<font class="string" color="black">"server"</font>&gt;<br />
 &lt;div&gt;<br />
 &lt;script type=<font class="string" color="black">"text/javascript"</font>&gt;<br />
        <font class="keyword" color="black">function</font> GridCreated()<br />
 {<br />
 window.setTimeout(SetFilterMenuClass(this), 500);<br />
 }<br />
        <font class="keyword" color="black">function</font>
SetFilterMenuClass(gridObject)<br />
 {<br />
 gridObject.FilterMenu.SelectColumnBackColor = <font class="string" color="black">""</font>;<br />
 gridObject.FilterMenu.TextColumnBackColor = <font class="string" color="black">""</font>;<br />
        <br />
 }<br />
 &lt;/script&gt;<br />
 &lt;radG:RadGrid ID=<font class="string" color="black">"RadGrid1"</font>
AllowFilteringByColumn=<font class="string" color="black">"true"</font>
DataSourceID=</font><font color="black"><font face="Courier New"><font class="string">
"AccessDataSource1"</font><br />
 AllowSorting= <font class="string">"True"</font>
runat=<font class="string">"server"</font>&gt;<br />
 &lt;FilterMenu
CssClass=<font class="string">"FilterMenuClass1"</font>&gt;&lt;/FilterMenu&gt;<br />
 &lt;ClientSettings&gt;<br />
 &lt;ClientEvents OnGridCreated=<font class="string">"GridCreated"</font>
/&gt;<br />
 &lt;/ClientSettings&gt;<br />
 &lt;/radG:RadGrid&gt;<br />
 &lt;br /&gt;<br />
 &lt;asp:AccessDataSource ID=<font class="string">"AccessDataSource1"</font>
DataFile=<font class="string">"~/Grid/Data/Access/Nwind.mdb"</font><br />
 SelectCommand= <font class="string">"SELECT TOP 10 CustomerID, CompanyName,
ContactName, ContactTitle, Address, PostalCode FROM Customers"</font><br />
 runat= <font class="string">"server"</font>&gt;&lt;/asp:AccessDataSource&gt;<br />
 &lt;radG:RadGrid ID=<font class="string">"RadGrid2"</font>
DataSourceID=<font class="string">"AccessDataSource1"</font>
AllowSorting=<font class="string">"True"</font><br />
 AllowFilteringByColumn= <font class="string">"true"</font>
Skin=<font class="string">"Windows"</font>
runat=<font class="string">"server"</font>&gt;<br />
 &lt;ClientSettings&gt;<br />
 &lt;ClientEvents OnGridCreated=<font class="string">"GridCreated"</font>
/&gt;<br />
 &lt;/ClientSettings&gt;<br />
 &lt;FilterMenu
CssClass=<font class="string">"FilterMenuClass2"</font>&gt;&lt;/FilterMenu&gt;<br />
 &lt;/radG:RadGrid&gt;<br />
 &lt;/div&gt;<br />
 &lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</font></font></p>

Change the filter type displayed in the filter dropdown

C#
public virtual GridFilterType FilterType { get; set; }

Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the footer item in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle FooterStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the footer item in a Telerik RadGrid control.

Use the FooterItemStyle property to control the appearance of the footer item in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, FooterItemStyle-ForeColor).
  • Nest a <FooterItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, FooterItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
Skin=""
ShowFooter="true" &gt;
&lt;FooterStyle BackColor="red" /&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the group-header item in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle GroupHeaderItemStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the group-header item in a Telerik RadGrid control.

Use the GroupHeaderItemStyle property to control the appearance of the group-header item in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, GroupHeaderItemStyle-ForeColor).
  • Nest a <GroupHeaderItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, GroupHeaderItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
Skin="None" &gt;
&lt;GroupHeaderItemStyle BackColor="red"  /&gt;
&lt;MasterTableView&gt;
&lt;GroupByExpressions&gt;
&lt;radG:GridGroupByExpression&gt;
&lt;SelectFields&gt;
&lt;radG:GridGroupByField FieldAlias="CompanyName" FieldName="CompanyName" &gt;&lt;/radG:GridGroupByField&gt;
&lt;/SelectFields&gt;
&lt;GroupByFields&gt;
&lt;radG:GridGroupByField FieldName="CompanyName" SortOrder="Descending"&gt;&lt;/radG:GridGroupByField&gt;
&lt;/GroupByFields&gt;
&lt;/radG:GridGroupByExpression&gt;
&lt;/GroupByExpressions&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets a value indicating whether the grouping is enabled.

C#
[Bindable(true)]
public virtual bool GroupingEnabled { get; set; }
Property Value:

true, when the automatic grouping is enabled; otherwise false. The default is false.

Most often this property is used in conjunction with ShowGroupPanel property set to true. The easiest way to turn the grouping on is by using the grid's SmartTag option for enabling the grouping.

Gets a reference to the GridGroupingSettings object that allows you to set the properties of the grouping operation in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridGroupingSettings GroupingSettings { get; }
Property Value:

A reference to the GridGroupingSettings that allows you to set the properties of the grouping operation in a Telerik RadGrid control.

Use the GroupingSettings property to control the settings of the grouping operations in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridGroupingSettings object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridGroupingSettings object (for example, GroupingSettings-ExpandTooltip).
  • Nest a <GroupingSettings> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, GroupingSettings.ExpandTooltip). Common settings usually include the tool tips for the sorting controls.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"&gt;
&lt;GroupingSettings ExpandTooltip="ExpandTooltip" /&gt;
&lt;MasterTableView&gt;
&lt;GroupByExpressions&gt;
&lt;radG:GridGroupByExpression&gt;
&lt;SelectFields&gt;
&lt;radG:GridGroupByField FieldAlias="CompanyName" FieldName="CompanyName" &gt;&lt;/radG:GridGroupByField&gt;
&lt;/SelectFields&gt;
&lt;GroupByFields&gt;
&lt;radG:GridGroupByField FieldName="CompanyName" SortOrder="Descending"&gt;&lt;/radG:GridGroupByField&gt;
&lt;/GroupByFields&gt;
&lt;/radG:GridGroupByExpression&gt;
&lt;/GroupByExpressions&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;&lt;see cref="NorthwindConnectionString"&gt;$ ConnectionStrings&lt;/see&gt;&gt;"
SelectCommand="SELECT [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets group panel control instance - visible only if grouping is enabled in grid (GroupingEnabled). Each GridTableView's Group-By-Expression is visualized in this panel.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridGroupPanel GroupPanel { get; }

If grouping is enabled grid allows grouping by column(s) by drag-and-drop of columns from it's detail tables in this panel For this purpose set AllowDragToGroup property to true. You can modify panel's appearance using PanelStyle and PanelItemsStyle.

Specify the position of the of GroupPanel

C#
[Bindable(true)]
public virtual GridGroupPanelPosition GroupPanelPosition { get; set; }

Represents a HeaderContextMenu

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridHeaderContextMenu HeaderContextMenu { get; }

Gets the style properties of the heading section in the RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle HeaderStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the header item in a Telerik RadGrid control.

Use the HeaderItemStyle property to control the appearance of the header item in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, HeaderItemStyle-ForeColor).
  • Nest a <HeaderItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, HeaderItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
Skin="" &gt;
&lt;HeaderStyle BackColor="red" /&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets a reference to the GridHierarchySettings object that allows you to set the properties of the hierarchical Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridHierarchySettings HierarchySettings { get; }
Property Value:

A reference to the GridHierarchySettings that allows you to set the properties of the hierarchical Telerik RadGrid control.

Use the HierarchySettings property to control the settings of the hierarchical Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridHierarchySettings object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridHierarchySettings object (for example, HierarchySettings-CollapseTooltip).
  • Nest a <HierarchySettings> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, HierarchySettings.CollapseTooltip). Common settings usually include the tool tips for the hierarchical Telerik RadGrid control.

Example:
C#

Gets or sets default path for the grid images.

C#
public virtual string ImagesPath { get; set; }
Property Value:

A string containing the path for the grid images. The default is string.Empty.

Gets or sets the name of the method to call in order to insert data

C#
public string InsertMethod { get; set; }
C#
protected virtual bool IsBoundUsingOData { get; }

This property returns true when the control is currently exporting a file

C#
[Browsable(false)]
public bool IsExporting { get; }

Gets a collection of all GridDataItems.

C#
[Browsable(false)]
public virtual GridDataItemCollection Items { get; }
Property Value:

all grid data items as GridDataItemCollection

The RadGrid control automatically populates the Items collection by creating a GridDataItem object for each record in the data source and then adding each object to the collection. This property is commonly used to access a specific item in the control or to iterate though the entire collection of items.

You cannot use this collection to get special Items like Header, Pager, Footer, etc. Handle ItemCreated event and use the event arguments to get a reference to such items.

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

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle ItemStyle { get; }
Property Value:

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

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.

Example:
C#
&lt;%@ Page language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

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

&lt;radG:RadGrid id="CustomersGridView"
datasourceid="CustomersSource"
autogeneratecolumns="true"
Skin=""
runat="server"&gt;

&lt;itemstyle backcolor="LightCyan"
forecolor="DarkBlue"
font-italic="true"/&gt;

&lt;alternatingitemstyle backcolor="PaleTurquoise"
forecolor="DarkBlue"
font-italic="true"/&gt;

&lt;/radG:RadGrid&gt;

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

&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets a value indicating where RadGrid will look for its .resx localization file. By default this file should be in the App_GlobalResources folder. However, if you cannot put the resource file in the default location or .resx files compilation is disabled for some reason (e.g. in a DotNetNuke environment), this property should be set to the location of the resource file.

C#
public string LocalizationPath { get; set; }
Property Value:

A relative path to the dialogs location. For example: "~/controls/RadGridResources/".

If specified, the LocalizationPath property will allow you to load the grid localization file from any location in the web application.

The instance of GridTableView that represents the main grid-table view in RadGrid.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
[Bindable(false)]
public virtual GridTableView MasterTableView { get; }
Property Value:

A reference to the topmost GridTableView, i.e the MasterTableView.

Telerik RadGrid introduces a new approach to hierarchical data structures. The innovative in Telerik RadGrid is having a so called MasterTableView. This is the topmost table of the hierarchical structure. It is a GridTableView with GridTableViewCollection. The collection holds the so called DetailTables - tables related to the fields of the MasterTable. Each DetailTable can have its own GridTableViewCollection with other Detail Tables, thus forming the hierarchical structure.

Note: There is only one Master Table for a single Telerik RadGrid. This is the topmost table. All inner tables are referred as a Detail Tables regardless of whether they have related (inner) tables or not.
Example:
C#
&lt;radg:radgrid id="RadGrid1" runat="server"

CssClass= "RadGrid" Width="100%" AutoGenerateColumns="False" PageSize="3" AllowSorting="True"

AllowMultiRowSelection= "False" AllowPaging="True" GridLines="None" AllowFilteringByColumn="true"&gt;

&lt;PagerStyle Mode="NumericPages" CssClass="Pager"&gt;&lt;/PagerStyle&gt;

&lt;HeaderStyle CssClass="Header"&gt;&lt;/HeaderStyle&gt;

&lt;ItemStyle CssClass="Row"&gt;&lt;/ItemStyle&gt;

&lt;AlternatingItemStyle CssClass="AltRow"&gt;&lt;/AlternatingItemStyle&gt;

&lt;MasterTableView DataKeyNames="CustomerID" AllowMultiColumnSorting="True"&gt;

&lt;DetailTables&gt;

&lt;radG:GridTableView DataKeyNames="OrderID" DataMember="Orders"&gt;

&lt;ParentTableRelation&gt;

&lt;radG:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" /&gt;

&lt;/ParentTableRelation&gt;
&lt;DetailTables&gt;

&lt;radG:GridTableView DataKeyNames="OrderID" DataMember="OrderDetails"&gt;

&lt;ParentTableRelation&gt;

&lt;radG:GridRelationFields DetailKeyField="OrderID" MasterKeyField="OrderID" /&gt;

&lt;/ParentTableRelation&gt;

&lt;Columns&gt;

&lt;radG:GridBoundColumn SortExpression="UnitPrice" HeaderText="Unit Price" HeaderButtonType="TextButton"

DataField= "UnitPrice"&gt;

&lt;/radG:GridBoundColumn&gt;

&lt;radG:GridBoundColumn SortExpression="Quantity" HeaderText="Quantity" HeaderButtonType="TextButton"

DataField= "Quantity"&gt;
&lt;/radG:GridBoundColumn&gt;

&lt;radG:GridBoundColumn SortExpression="Discount" HeaderText="Discount" HeaderButtonType="TextButton"

DataField= "Discount"&gt;
&lt;/radG:GridBoundColumn&gt;

&lt;/Columns&gt;
&lt;SortExpressions&gt;

&lt;radG:GridSortExpression FieldName="Quantity" SortOrder="Descending"&gt;&lt;/radG:GridSortExpression&gt;

&lt;/SortExpressions&gt;
&lt;ItemStyle BackColor="#A7B986"&gt;&lt;/ItemStyle&gt;

&lt;HeaderStyle CssClass="Header1"&gt;&lt;/HeaderStyle&gt;

&lt;AlternatingItemStyle BackColor="#D9E8C4"&gt;&lt;/AlternatingItemStyle&gt;

&lt;/radG:GridTableView&gt;

&lt;/DetailTables&gt;

&lt;Columns&gt;

&lt;radG:GridBoundColumn SortExpression="OrderID" HeaderText="OrderID" HeaderButtonType="TextButton"

DataField= "OrderID"&gt;
&lt;/radG:GridBoundColumn&gt;

&lt;radG:GridBoundColumn SortExpression="OrderDate" HeaderText="Date Ordered" HeaderButtonType="TextButton"

DataField= "OrderDate"&gt;
&lt;/radG:GridBoundColumn&gt;

&lt;radG:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton"

DataField= "EmployeeID"&gt;
&lt;/radG:GridBoundColumn&gt;

&lt;/Columns&gt;
&lt;SortExpressions&gt;

&lt;radG:GridSortExpression FieldName="OrderDate"&gt;&lt;/radG:GridSortExpression&gt;

&lt;/SortExpressions&gt;
&lt;ItemStyle Height="19px" BackColor="#FCEDB0"&gt;&lt;/ItemStyle&gt;

&lt;HeaderStyle CssClass="Header2" ForeColor="#ffffff"&gt;&lt;/HeaderStyle&gt;

&lt;AlternatingItemStyle Height="19px" BackColor="#D5B96A"&gt;&lt;/AlternatingItemStyle&gt;

&lt;/radG:GridTableView&gt;
&lt;/DetailTables&gt;

&lt;Columns&gt;

&lt;radG:GridBoundColumn SortExpression="CustomerID" HeaderText="CustomerID" HeaderButtonType="TextButton"

DataField= "CustomerID"&gt;

&lt;/radG:GridBoundColumn&gt;

&lt;radG:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" HeaderButtonType="TextButton"

DataField= "ContactName"&gt;

&lt;/radG:GridBoundColumn&gt;

&lt;radG:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" HeaderButtonType="TextButton"

DataField= "CompanyName"&gt;

&lt;/radG:GridBoundColumn&gt;
&lt;/Columns&gt;

&lt;SortExpressions&gt;

&lt;radG:GridSortExpression FieldName="CompanyName"&gt;&lt;/radG:GridSortExpression&gt;

&lt;/SortExpressions&gt;
&lt;/MasterTableView&gt;

&lt;SelectedItemStyle ForeColor="White" BackColor="DarkBlue" CssClass=""&gt;&lt;/SelectedItemStyle&gt;

&lt;/radg:radgrid&gt;

Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the MultiHeader item in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle MultiHeaderItemStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the multi header item in a Telerik RadGrid control.

Gets or sets the ODataDataSource used for data binding.

C#
public virtual string ODataDataSourceID { get; set; }

Gets the number of pages required to display the records of the data source in a Telerik RadGrid control.

C#
[Browsable(false)]
public int PageCount { get; }
Property Value:

The number of pages in a Telerik RadGrid control.

When the paging feature is enabled (by setting the AllowPaging property to true), use the PageCount property to determine the total number of pages required to display the records in the data source. This value is calculated by dividing the total number of records in the data source by the number of records displayed in a page (as specified by the PageSize property) and rounding up.

Example:
cs-api-definition
&lt;%@ Page Language="C#" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
Label1.Text = RadGrid1.PageCount.ToString();
}
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
AllowPaging="true"
runat="server" OnPreRender="RadGrid1_PreRender"&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets a reference to the GridPagerStyle object that allows you to set the appearance of the page item in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridPagerStyle PagerStyle { get; }
Property Value:

A GridPagerStyle object that contains the style properties of the paging section of the RadGrid control. The default value is an empty GridPagerStyle object.

Use this property to provide a custom style for the paging section of the RadGrid control. Common style attributes that can be adjusted include forecolor, backcolor, font, and content alignment within the cell. Providing a different style enhances the appearance of the RadGrid control.

To specify a custom style for the paging section, place the <PagerStyle> tags between the opening and closing tags of the RadGrid control. You can then list the style attributes within the opening <PagerStyle> tag.

Example:
cs-api-definition
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Import Namespace="System.Data" &lt;see cref="&gt; &lt;"/&gt;@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %&gt;
&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;script runat="server"&gt;

Function CreateDataSource() As ICollection
Dim dt As New DataTable()
Dim dr As DataRow

dt.Columns.Add(New DataColumn("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn("DateTimeValue", GetType(String)))
dt.Columns.Add(New DataColumn("BoolValue", GetType(Boolean)))

Dim i As Integer
For i = 0 To 99
dr = dt.NewRow()

dr(0) = i
dr(1) = "Item " &amp; i.ToString()
dr(2) = DateTime.Now.ToShortDateString()
If i Mod 2 &lt;&gt; 0 Then
dr(3) = True
Else
dr(3) = False
End If

dt.Rows.Add(dr)
Next i

Dim dv As New DataView(dt)
Return dv
End Function 'CreateDataSource

Sub ShowStats()
lblEnabled.Text = "AllowPaging is " &amp; RadGrid1.AllowPaging
lblCurrentIndex.Text = "CurrentPageIndex is " &amp; RadGrid1.CurrentPageIndex
lblPageCount.Text = "PageCount is " &amp; RadGrid1.PageCount
lblPageSize.Text = "PageSize is " &amp; RadGrid1.PageSize
End Sub 'ShowStats


Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
RadGrid1.DataSource = CreateDataSource()
ShowStats()
End Sub

Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
RadGrid1.PagerStyle.Mode = GridPagerMode.NumericPages
Else
RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrev
End If

RadGrid1.Rebind()
End Sub
&lt;/script&gt;

&lt;head id="Head1" runat="server"&gt;
&lt;title&gt;RadGrid Paging Example&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h3&gt;
RadGrid Paging Example&lt;/h3&gt;
&lt;form id="form1" runat="server"&gt;
&lt;radG:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"&gt;
&lt;PagerStyle Mode="NumericPages" HorizontalAlign="Right"&gt;&lt;/PagerStyle&gt;
&lt;HeaderStyle BackColor="#aaaadd"&gt;&lt;/HeaderStyle&gt;
&lt;AlternatingItemStyle BackColor="#eeeeee"&gt;&lt;/AlternatingItemStyle&gt;
&lt;/radG:RadGrid&gt;
&lt;br /&gt;
&lt;asp:CheckBox ID="CheckBox1" runat="server" Text="Show numeric page navigation buttons"
AutoPostBack="true" /&gt;
&lt;br /&gt;
&lt;table style="background-color: #eeeeee; padding: 6"&gt;
&lt;tr&gt;
&lt;td style="display: inline"&gt;
&lt;asp:Label ID="lblEnabled" runat="server" /&gt;&lt;br /&gt;
&lt;asp:Label ID="lblCurrentIndex" runat="server" /&gt;&lt;br /&gt;
&lt;asp:Label ID="lblPageCount" runat="server" /&gt;&lt;br /&gt;
&lt;asp:Label ID="lblPageSize" runat="server" /&gt;&lt;br /&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets an integer value indicating the number of Items that a single page in Telerik RadGrid will contain.

C#
public virtual int PageSize { get; set; }
Property Value:

integer, indicating the number of the Items that a single grid page would contain.

Note that the Paging must be enabled (AllowPaging must be true) in order to use this property.

Gets or sets a value indicating if the Expanded property of both hierarchy and group items will be retained after a call to Rebind() or Rebind() method.

C#
public bool RetainExpandStateOnRebind { get; set; }

Gets a collection of indexes of the selected items.

C#
[Browsable(false)]
public GridIndexCollection SelectedCellIndexes { get; }
Property Value:

returns GridIndexCollection of the indexes of all selected Items.

Gets a collection of the currently selected GridTableCells

C#
[Browsable(false)]
public GridTableCellCollection SelectedCells { get; }
Property Value:

Returns a GridTableCellCollection of all selected cells.

Gets a collection of indexes of the selected items.

C#
[Browsable(false)]
public GridIndexCollection SelectedIndexes { get; }
Property Value:

returns GridIndexCollection of the indexes of all selected Items.

Example:
cs-api-definition
private void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RadGrid1.SelectedIndexes.Add(1, 0, 1, 0, 1);
//Index of 1, 0, 1, 0, 1 means:
//1 - item with index 1 in the MasterTabelView
//0 - detail table with index 0
//1 - item with index 1 (the second item) in the first detail table
//0 - 0 the third-level detail table
//1 - the item with index 1 in the third-level table
}
}

Gets a collection of the currently selected GridDataItems

C#
[Browsable(false)]
public GridItemCollection SelectedItems { get; }
Property Value:

Returns a GridItemCollection of all selected data items.

Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the selected item in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle SelectedItemStyle { get; }
Property Value:

A reference to the GridTableItemStyle that represents the style of the selected item in a Telerik RadGrid control.

Use the SelectedItemStyle property to control the appearance of the selected item in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridTableItemStyle object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, SelectedItemStyle-ForeColor).
  • Nest a <SelectedItemStyle> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, SelectedItemStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
Skin=""&gt;
&lt;SelectedItemStyle BackColor="red" /&gt;
&lt;MasterTableView&gt;
&lt;Columns&gt;
&lt;radG:GridButtonColumn
Text="Select"
UniqueName="Select"
CommandName="Select"&gt;
&lt;/radG:GridButtonColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets the data key value of the selected row in a RadGrid control.

C#
[Browsable(false)]
public object SelectedValue { get; }
Property Value:

The data key value of the selected row in a RadGrid control.

Example:
cs-api-definition
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;
&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;

Sub RadGrid1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

' Display the primary key value of the selected row.
Label1.Text = "The primary key value of the selected row is " &amp; _
RadGrid1.SelectedValue.ToString() &amp; "."

End Sub

&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
&lt;title&gt;RadGrid SelectedValue Example&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;h3&gt;
RadGrid SelectedValue Example&lt;/h3&gt;
&lt;asp:Label ID="Label1" ForeColor="Red" runat="server" /&gt;
&lt;radG:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1"
OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged"
runat="server"&gt;
&lt;MasterTableView DataKeyNames="CustomerID"&gt;
&lt;Columns&gt;
&lt;radG:GridButtonColumn CommandName="Select" Text="Select" /&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource ID="SqlDataSource1" SelectCommand="SELECT * FROM [Customers]"
runat="server" ConnectionString="&lt;&lt;see cref="NorthwindConnectionString"&gt;$ ConnectionStrings&lt;/see&gt;&gt;" /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets the corresponding data key values for the selected items in the grid.

C#
[Browsable(false)]
public DataKey SelectedValues { get; }
Property Value:

The corresponding data key values for the selected items in the grid.

Gets or sets the name of the method to call in order to select data

C#
public override string SelectMethod { get; set; }

Overrides: DataBoundControl.SelectMethod

Gets or set a value indicating whether the footer item of the grid will be shown.

C#
[Bindable(true)]
public virtual bool ShowFooter { get; set; }
Property Value:

The default value of this property is false.

Setting this property will affect all grid tables, unless they specify otherwise explicitly.

Gets or sets a value indicating whether the GridGroupPanel would be shown in Telerik RadGrid.

C#
[Bindable(true)]
public virtual bool ShowGroupPanel { get; set; }
Property Value:

true, when Telerik RadGrid will display the panel; otherwise false. The default is false.

Gets or set a value indicating whether the header item of the grid will be shown.

C#
[Bindable(true)]
public virtual bool ShowHeader { get; set; }
Property Value:

This default value for this property is true.

Setting this property will affect all grid tables, unless they specify otherwise explicitly.

Gets or set a value indicating whether the statusbar item of the grid will be shown.

C#
[Bindable(true)]
public virtual bool ShowStatusBar { get; set; }
Property Value:

true if the status bar item would be shown, otherwise false. The default value of this property is false.

This property is meaningful when the grid is in AJAX mode, i.e. when EnableAJAX is set to true.

Gets or sets the name of the Skin that Telerik RadGrid will use. In case one needs custom skin (not embedded within the assembly) she has to refer the respective .css in the head tag as explained in docs here: RadControls for ASP.NET Ajax Fundamentals -> Controlling Visual Appearance -> Creating a custom skin

C#
public override string Skin { get; set; }
Property Value:

The name of the skin as String.

Overrides: RadCompositeDataBoundControl.Skin

There are three possible scenarios for using this property:

  • Leave this property unset or set it to "Default" - the default skin, common for the Telerik� UI for ASP.NET Ajax suite will be used
  • Set the name of the embedded grid skin - the skin will be applied
  • Set the name of the custom grid skin along with the EnableEmbeddedSkins="false" (see 'Creating a custom skin' Fundamentals article)
  • Set this property to "" - no skin will be applied. Only the default grid images (for Expand/Collapse, Sort, Edit, etc) will be used. Use this option if you have own appearance customizations for prevous Telerik RadGrid versions.

Gets or sets a value indicating whether the Columns in the HeaderContextMenu will be sorted by default.

C#
public virtual bool SortHeaderContextMenuColumns { get; set; }
Property Value:

true if the sorting of the header context menu columns is enabled; otherwise, false.

Gets a reference to the GridSortingSettings object that allows you to set the properties of the sorting operation in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridSortingSettings SortingSettings { get; }
Property Value:

A reference to the GridSortingSettings that allows you to set the properties of the sorting operation in a Telerik RadGrid control.

Use the SortingSettings property to control the settings of the sorting operations in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridSortingSettings object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridSortingSettings object (for example, SortingSettings-SortedAscToolTip).
  • Nest a <SortingSettings> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, SortingSettings.SortedAscToolTip). Common settings usually include the tool tips for the sorting controls.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server"
AllowSorting="true"&gt;
&lt;SortingSettings SortToolTip="SortToolTip" SortedAscToolTip="SortedAscToolTip" SortedDescToolTip="SortedDescToolTip" /&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;&lt;see cref="NorthwindConnectionString"&gt;$ ConnectionStrings&lt;/see&gt;&gt;"
SelectCommand="SELECT [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets a GridStatusBarItemSettings object that contains variable settings related to the status bar.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridStatusBarItemSettings StatusBarSettings { get; }
Property Value:

returns a reference to GridStatusBarItemSettings object.

Example:
C#
&lt;radG:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" ShowStatusBar="true" EnableAjax="true"&gt;
&lt;StatusBarSettings LoadingText="Loading... Please wait!" ReadyText="Online" /&gt;
&lt;/radG:RadGrid&gt;
C#
protected override bool SupportsRenderingMode { get; }

Overrides: RadCompositeDataBoundControl.SupportsRenderingMode

Gets or sets the name of the method to call in order to update data

C#
public string UpdateMethod { get; set; }

Gets a reference to the GridValidationSettings object that allows you to set the properties of the validate operation in a Telerik RadGrid control.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridValidationSettings ValidationSettings { get; }
Property Value:

A reference to the GridValidationSettings that allows you to set the properties of the validate operation in a Telerik RadGrid control.

Use the ValidationSettings property to control the settings of the validate operations in a Telerik RadGrid control. This property is read-only; however, you can set the properties of the GridValidationSettings object it returns. The properties can be set declaratively using one of the following methods:

  • Place an attribute in the opening tag of the Telerik RadGrid control in the form Property-Subproperty, where Subproperty is a property of the GridValidationSettings object (for example, ValidationSettings-EnableValidation).
  • Nest a <ValidationSettings> element between the opening and closing tags of the Telerik RadGrid control.

The properties can also be set programmatically in the form Property.Subproperty (for example, ValidationSettings.EnableValidation). Common settings usually include the propeties for the validation logic in Telerik RadGrid control.

Example:
C#
&lt;%@ Page Language="VB" %&gt;

&lt;%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
AutoGenerateColumns="false"
runat="server"&gt;
&lt;ValidationSettings
EnableValidation="true"
CommandsToValidate="PefrormInsert" /&gt;
&lt;MasterTableView CommandItemDisplay="TopAndBottom"&gt;
&lt;Columns&gt;
&lt;radG:GridEditCommandColumn&gt;
&lt;/radG:GridEditCommandColumn&gt;
&lt;radG:GridTemplateColumn HeaderText="ContactName" UniqueName="ContactName" DataField="ContactName"&gt;
&lt;ItemTemplate&gt;
&lt;%# Eval("ContactName") &lt;see cref="TextBox Text='&lt;"&gt;&gt;
&lt;/ItemTemplate&gt;
&lt;EditItemTemplate&gt;
&lt;asp&lt;/see&gt;# Bind("ContactName") %&gt;' ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
&lt;asp:RequiredFieldValidator ControlToValidate="TextBox1" ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator"&gt;&lt;/asp:RequiredFieldValidator&gt;
&lt;/EditItemTemplate&gt;
&lt;/radG:GridTemplateColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;&lt;see cref="NorthwindConnectionString"&gt;$ ConnectionStrings&lt;/see&gt;&gt;"
SelectCommand="SELECT TOP 3 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Gets or sets a value, indicating the total number of items in the data source when custom paging is used. Thus the grid "understands" that the data source contains the specified number of records and it should fetch merely part of them at a time to execute requested operation.

C#
[Browsable(true)]
[Bindable(true)]
public virtual int VirtualItemCount { get; set; }
Property Value:

int, representing the total number of items in the datasource. The default value is 0.

If you set a value that is greater than the actual number of items, RadGrid will show all available items plus empty pages (or whatever other content you set) for the items that exceed the actual number.

For example you have a data source with 9'000 items and you set VirtualItemCount to 10'000. If your page size is 1000, the grid will render 10 pages and the last page will be empty (or with NoRecordsTemplate if you're using such).

Gets or sets the width of the Web server control.

C#
public override Unit Width { get; set; }
Property Value:

A Unit that represents the width of the control. The default is Empty.

Exceptions: ArgumentException

The width of the Web server control was set to a negative value.

Overrides: RadCompositeDataBoundControl.Width

Methods

C#
protected virtual bool BrowserIsCrawler()
Returns:

bool

Code moved into this method from OnPreRender to make sure it executed when the framework skips OnPreRender() for some reason

C#
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
protected override void ControlPreRender()

Overrides: RadCompositeDataBoundControl.ControlPreRender()

Creates a RadGrid action button with a font icon and optional text.

C#
public static HtmlGenericControl CreateButton(string name, bool display = true)
Parameters:namestring

The action name which is used to build CSS classes and the default text.

displaybool

Whether the button should be initially visible.

Returns:

HtmlGenericControl

An HtmlGenericControl representing a button element.

Creates a RadGrid action button with a font icon and custom text.

C#
public static HtmlGenericControl CreateButton(string name, string text, bool display = true)
Parameters:namestring

The action name used to build CSS classes.

textstring

The button text and title.

displaybool

Whether the button should be initially visible.

Returns:

HtmlGenericControl

An HtmlGenericControl representing a button element.

C#
protected override int CreateChildControls(IEnumerable dataSource, bool dataBinding)
Parameters:dataSourceIEnumerabledataBindingboolReturns:

int

Overrides: RadCompositeDataBoundControl.CreateChildControls(IEnumerable, bool)

This method is used by RadGrid internally. Please do not use.

C#
public virtual GridTableView CreateTableView()
Returns:

GridTableView

Data-bind %MasterTableView% and its detail %GridTableView%s. Prior to calling DataBind, the %DataSource% property should be assigned.

C#
public override void DataBind()

Overrides: BaseDataBoundControl.DataBind()

You should have in mind, that in case you are using simple data binding (i.e. when you are not using NeedDataSource event) the correct approach is to call the DataBind() method on the first page load when !Page.IsPostBack and after handling some event (sort event for example).

You will need to assign DataSource and rebind the grid after each operation (paging, sorting, editing, etc.) - this copies exactly MS DataGrid behavior.

We recommend using the Rebind() method instead and handling the NeedDataSource event.

C#
protected override void DescribeComponent(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: RadCompositeDataBoundControl.DescribeComponent(IScriptDescriptor)

Exports RadGrid to Csv format

C#
public void ExportToCsv()

Exports RadGrid to Excel format

C#
public void ExportToExcel()

Exports RadGrid to the given Excel format

C#
public void ExportToExcel(GridExcelExportFormat format)
Parameters:formatGridExcelExportFormat

Excel format

Exports RadGrid to Pdf format

C#
public void ExportToPdf()

Exports RadGrid to Word format

C#
public void ExportToWord()

Exports RadGrid to the given Word format

C#
public void ExportToWord(GridWordExportFormat format)
Parameters:formatGridWordExportFormat

Word format

Gets a GridBindingData object that could be used when binding a RadGrid control to a service. The GetBindingData method have many overrides and their main purpose is to return a object to be used and returned from a service so a RadGrid control could handle complex operations like sorting, filtering, paging. In the general case the parameters are automatically passed when the RadGrid makes a request to the service. However, you could use it for custom scenarios by providing your manually generated parameters. https://www.telerik.com/products/aspnet-ajax/documentation/controls/grid/asp.net-3.5-features/client-binding-to-wcf-web-service-and-ado.net-data-service#binding-radgrid-for-asp-net-ajax-to-ado-net-data-service

C#
public static GridLinqBindingData GetBindingData(IQueryable source, int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
Parameters:sourceIQueryable

IQueryable collection to be paged, filtered and sorted.

startRowIndexint

The index from where to start retrieving records. The parameter is used for pagging support.

maximumRowsint

The maximum rows to be loaded. The parameter is used for pagging support.

sortExpressionstring

The sort expression.

filterExpressionstring

The filter expression.

Returns:

GridLinqBindingData

Returns a GridBindingData object which could be used to return the data to the RadGrid control.

Gets a GridBindingData object that could be used when binding a RadGrid control to a service. The GetBindingData method have many overrides and their main purpose is to return a object to be used and returned from a service so a RadGrid control could handle complex operations like sorting, filtering, paging. In the general case the parameters are automatically passed when the RadGrid makes a request to the service. However, you could use it for custom scenarios by providing your manually generated parameters. https://www.telerik.com/products/aspnet-ajax/documentation/controls/grid/asp.net-3.5-features/client-binding-to-wcf-web-service-and-ado.net-data-service

C#
public static GridBindingData GetBindingData(string contextTypeName, string tableName, int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
Parameters:contextTypeNamestring

The contextTypeName parameter for the GridLinqDataSource.

tableNamestring

The tableName parameter for the GridLinqDataSource.

startRowIndexint

The index from where to start retrieving records. The parameter is used for pagging support.

maximumRowsint

The maximum rows to be loaded. The parameter is used for pagging support.

sortExpressionstring

The sort expression.

filterExpressionstring

The filter expression.

Returns:

GridBindingData

Returns a GridBindingData object which could be used to return the data to the RadGrid control.

Gets a GridBindingData object that could be used when binding a RadGrid control to a service. The GetBindingData method have many overrides and their main purpose is to return a object to be used and returned from a service so a RadGrid control could handle complex operations like sorting, filtering, paging. In the general case the parameters are automatically passed when the RadGrid makes a request to the service. However, you could use it for custom scenarios by providing your manually generated parameters. https://www.telerik.com/products/aspnet-ajax/documentation/controls/grid/asp.net-3.5-features/client-binding-to-wcf-web-service-and-ado.net-data-service

C#
public static GridBindingData GetBindingData(string contextTypeName, string tableName, string select, int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
Parameters:contextTypeNamestring

The contextTypeName parameter for the GridLinqDataSource.

tableNamestring

The tableName parameter for the GridLinqDataSource.

selectstring

The select for the GridLinqDataSource.

startRowIndexint

The index from where to start retrieving records. The parameter is used for pagging support.

maximumRowsint

The maximum rows to be loaded. The parameter is used for pagging support.

sortExpressionstring

The sort expression.

filterExpressionstring

The filter expression.

Returns:

GridBindingData

Returns a GridBindingData object which could be used to return the data to the RadGrid control.

Gets a GridBindingData object that could be used when binding a RadGrid control to a service. The RadGrid.GetBindingData method have many overrides and their main purpose is to return a object to be used and returned from a service so a RadGrid control could handle complex operations like sorting, filtering, paging. In the general case the parameters are automatically passed when the RadGrid makes a request to the service. However, you could use it for custom scenarios by providing your manually generated parameters. https://www.telerik.com/products/aspnet-ajax/documentation/controls/grid/asp.net-3.5-features/client-binding-to-wcf-web-service-and-ado.net-data-service#binding-radgrid-for-asp-net-ajax-to-ado-net-data-service

C#
public static GridLinqBindingData<T> GetBindingData<T>(IQueryable<T> source, int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
Parameters:sourceIQueryable<T>

Generic IQueryable<T> collection to be paged, filtered and sorted.

startRowIndexint

The index from where to start retrieving records. The parameter is used for pagging support.

maximumRowsint

The maximum rows to be loaded. The parameter is used for pagging support.

sortExpressionstring

The sort expression.

filterExpressionstring

The filter expression.

Returns:

GridLinqBindingData<T>

Returns a GridBindingData object which could be used to return the data to the RadGrid control.

C#
public string GetCallbackResult()
Returns:

string

Implements: ICallbackEventHandler.GetCallbackResult()

C#
protected override DataSourceView GetData()
Returns:

DataSourceView

Overrides: DataBoundControl.GetData()

C#
protected override IEnumerable<ScriptReference> GetScriptReferences()
Returns:

IEnumerable<ScriptReference>

Overrides: RadCompositeDataBoundControl.GetScriptReferences()

C#
protected override string GetSkinSuffix()
Returns:

string

Overrides: RadCompositeDataBoundControl.GetSkinSuffix()

C#
protected virtual object GetSPViewFieldValue<T>(T resultItem, string fieldName)
Parameters:resultItemTfieldNamestringReturns:

object

C#
protected void headerContextMenu_ItemClick(object sender, RadMenuEventArgs e)
Parameters:senderobjecteRadMenuEventArgs

Loads the client state data

C#
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
protected override bool LoadClientState(Dictionary<string, object> clientState)
Parameters:clientStateDictionary<string, object>Returns:

bool

Overrides: RadCompositeDataBoundControl.LoadClientState(Dictionary<string, object>)

C#
protected override void LoadViewState(object savedStateObject)
Parameters:savedStateObjectobject

Overrides: GridBaseDataList.LoadViewState(object)

C#
protected virtual void OnBatchEditCommand(GridBatchEditingEventArgs e)
Parameters:eGridBatchEditingEventArgs
C#
protected virtual void OnBiffExporting(GridBiffExportingEventArgs e)
Parameters:eGridBiffExportingEventArgs
C#
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
protected override bool OnBubbleEvent(object source, EventArgs e)
Parameters:sourceobjecteEventArgsReturns:

bool

Overrides: Control.OnBubbleEvent(object, EventArgs)

C#
protected virtual void OnCancelCommand(GridCommandEventArgs e)
Parameters:eGridCommandEventArgs
C#
protected virtual void OnColumnCreated(GridColumnCreatedEventArgs e)
Parameters:eGridColumnCreatedEventArgs
C#
protected virtual void OnColumnCreating(GridColumnCreatingEventArgs e)
Parameters:eGridColumnCreatingEventArgs
C#
protected virtual void OnCreateColumnEditor(GridCreateColumnEditorEventArgs e)
Parameters:eGridCreateColumnEditorEventArgs
C#
protected virtual void OnCustomAggregate(GridCustomAggregateEventArgs e)
Parameters:eGridCustomAggregateEventArgs
C#
protected override void OnDataBound(EventArgs e)
Parameters:eEventArgs

Overrides: BaseDataBoundControl.OnDataBound(EventArgs)

C#
protected override void OnDataSourceViewChanged(object sender, EventArgs e)
Parameters:senderobjecteEventArgs

Overrides: DataBoundControl.OnDataSourceViewChanged(object, EventArgs)

C#
protected virtual void OnDeleteCommand(GridCommandEventArgs e)
Parameters:eGridCommandEventArgs
C#
protected virtual void OnDetailTableDataBind(GridDetailTableDataBindEventArgs e)
Parameters:eGridDetailTableDataBindEventArgs
C#
protected virtual void OnEditCommand(GridCommandEventArgs e)
Parameters:eGridCommandEventArgs
C#
protected virtual void OnExcelExportCellFormatting(ExcelExportCellFormattingEventArgs e)
Parameters:eExcelExportCellFormattingEventArgs
C#
protected virtual void OnExcelMLExportRowCreated(GridExportExcelMLRowCreatedArgs e)
Parameters:eGridExportExcelMLRowCreatedArgs
C#
protected virtual void OnExcelMLExportStylesCreated(GridExportExcelMLStyleCreatedArgs e)
Parameters:eGridExportExcelMLStyleCreatedArgs
C#
protected virtual void OnExcelMLWorkBookCreated(GridExcelMLWorkBookCreatedEventArgs e)
Parameters:eGridExcelMLWorkBookCreatedEventArgs
C#
protected virtual void OnExportCellFormatting(ExportCellFormattingEventArgs e)
Parameters:eExportCellFormattingEventArgs
C#
protected virtual void OnFieldDescriptorsReady(RadFilterFildDesciptorsEventArgs e)
Parameters:eRadFilterFildDesciptorsEventArgs
C#
protected virtual bool OnFilterCheckListItemsRequested(GridFilterCheckListItemsRequestedEventArgs e)
Parameters:eGridFilterCheckListItemsRequestedEventArgsReturns:

bool

C#
protected virtual void OnGridExporting(GridExportingArgs e)
Parameters:eGridExportingArgs
C#
protected virtual void OnGroupsChanging(GridGroupsChangingEventArgs e)
Parameters:eGridGroupsChangingEventArgs
C#
protected virtual void OnHTMLExporting(GridHTMLExportingEventArgs e)
Parameters:eGridHTMLExportingEventArgs
C#
protected virtual void OnInfrastructureExporting(GridInfrastructureExportingEventArgs e)
Parameters:eGridInfrastructureExportingEventArgs
C#
protected override void OnInit(EventArgs e)
Parameters:eEventArgs

Overrides: GridBaseDataList.OnInit(EventArgs)

C#
protected virtual void OnInsertCommand(GridCommandEventArgs e)
Parameters:eGridCommandEventArgs
C#
protected virtual void OnItemCommand(GridCommandEventArgs e)
Parameters:eGridCommandEventArgs
C#
protected virtual void OnItemCreated(GridItemEventArgs e)
Parameters:eGridItemEventArgs
C#
protected virtual void OnItemDataBound(GridItemEventArgs e)
Parameters:eGridItemEventArgs
C#
protected virtual void OnItemDeleted(GridDeletedEventArgs e)
Parameters:eGridDeletedEventArgs
C#
protected virtual void OnItemEvent(GridItemEventArgs e)
Parameters:eGridItemEventArgs
C#
protected virtual void OnItemInserted(GridInsertedEventArgs e)
Parameters:eGridInsertedEventArgs
C#
protected virtual void OnItemUpdated(GridUpdatedEventArgs e)
Parameters:eGridUpdatedEventArgs
C#
protected override void OnLoad(EventArgs e)
Parameters:eEventArgs

Overrides: DataBoundControl.OnLoad(EventArgs)

C#
protected virtual bool OnNeedDataSource(GridNeedDataSourceEventArgs e)
Parameters:eGridNeedDataSourceEventArgsReturns:

bool

C#
protected virtual void OnPageIndexChanged(GridPageChangedEventArgs e)
Parameters:eGridPageChangedEventArgs
C#
protected virtual void OnPageSizeChanged(GridPageSizeChangedEventArgs e)
Parameters:eGridPageSizeChangedEventArgs
C#
protected virtual void OnPdfExporting(GridPdfExportingArgs e)
Parameters:eGridPdfExportingArgs
C#
protected virtual void OnRowDropEvent(IList<GridDataItem> draggedItems, GridDataItem destinationItem, RadGrid parentGrid, GridItemDropPosition dropPosition, GridTableView destinationItemTableView)
Parameters:draggedItemsIList<GridDataItem>destinationItemGridDataItemparentGridRadGriddropPositionGridItemDropPositiondestinationItemTableViewGridTableView
C#
protected virtual void OnRowDropEvent(IList<GridDataItem> draggedItems, string htmlElementId)
Parameters:draggedItemsIList<GridDataItem>htmlElementIdstring
C#
protected virtual void OnSortCommand(GridSortCommandEventArgs e)
Parameters:eGridSortCommandEventArgs
C#
protected virtual void OnUpdateCommand(GridCommandEventArgs e)
Parameters:eGridCommandEventArgs

Used by the SPRadGrid control

C#
protected virtual List<DataColumn> ParseSPViewFieldsIntoDataColumns<T>(T firstObject)
Parameters:firstObjectTReturns:

List<DataColumn>

C#
protected override void PrepareControlHierarchy()

Overrides: GridBaseDataList.PrepareControlHierarchy()

C#
public void RaiseCallbackEvent(string eventArgument)
Parameters:eventArgumentstring

Implements: ICallbackEventHandler.RaiseCallbackEvent(string)

Executed when post data changes should invoke a changed event

C#
protected override void RaisePostDataChangedEvent()

Overrides: RadCompositeDataBoundControl.RaisePostDataChangedEvent()

Forces RadGrid to fire NeedDataSource event then calls DataBind.

C#
public virtual void Rebind()
C#
protected override void RenderContents(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: RadCompositeDataBoundControl.RenderContents(HtmlTextWriter)

C#
protected override object SaveViewState()
Returns:

object

Overrides: GridBaseDataList.SaveViewState()

C#
protected override void TrackViewState()

Overrides: DataBoundControl.TrackViewState()

Events

The event which is fired when a batch edit operation is made.

C#
public event GridBatchEditEventHandler BatchEditCommand

Fires when a grid is exporting to BIFF format

C#
public event EventHandler<GridBiffExportingEventArgs> BiffExporting

Occurs when the Cancel button is clicked for an item in the Telerik RadGrid control.

C#
public event GridCommandEventHandler CancelCommand

The CancelCommand event is raised when the Cancel button is clicked for an item in the Telerik RadGrid control.

Example:
C#
&lt;%@ Page Language="VB" &gt; @ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;

Protected Sub RadGrid1_CancelCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
Response.Write("Cancel")
End Sub

&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server" OnCancelCommand="RadGrid1_CancelCommand" &gt;
&lt;MasterTableView&gt;
&lt;Columns&gt;
&lt;radG:GridEditCommandColumn&gt;
&lt;/radG:GridEditCommandColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$ ConnectionStrings: NorthwindConnectionString %&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

This event is fired after the creation of auto-generated columns.

C#
public event GridColumnCreatedEventHandler ColumnCreated

The ColumnCreated event of Telerik RadGrid is designated to customize auto-generated columns at runtime (for example DataFormatString, ReadOnly or other properties of these auto-generated columns).

Fires before a custom column is created. You can handle the event to replace or modify the instance of the column that should be created and added into the collection of column in the corresponding GridTableView.

C#
public event GridColumnCreatingEventHandler ColumnCreating

The ColumnCreating event of Telerik RadGrid is fired only for custom grid columns. It is not designed to be used to cancel the creation of auto-generated columns. Its purpose is to have place where to define your custom columns (extending the default grid columns) programmatically and add them to the grid Columns collection.

See the manual part of Telerik RadGrid documentation for details about Telerik RadGrid inheritance.

Fires when a columns reorder action has been performed.

C#
public event GridColumnsReorderEventHandler ColumnsReorder

Fires when each editable column creates its column editor, prior to initializing its controls in the cells of the grid

C#
public event GridCreateColumnEditorEventHandler CreateColumnEditor
C#
public event GridCustomAggregateEventHandler CustomAggregate

Occurs when the Delete button is clicked for an item in the Telerik RadGrid control.

C#
public event GridCommandEventHandler DeleteCommand

The DeleteCommand event is raised when the Delete button is clicked for an item in the Telerik RadGrid control.

A typical handler for the DeleteCommand event removes the selected item from the data source.

Example:
C#
&lt;%@ Page Language="VB" /&gt; @ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;

Protected Sub RadGrid1_DeleteCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
Response.Write("Delete")
End Sub
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server" OnDeleteCommand="RadGrid1_DeleteCommand"  &gt;
&lt;MasterTableView&gt;
&lt;Columns&gt;
&lt;radG:GridButtonColumn Text="Delete" CommandName="Delete" UniqueName="Delete"&gt;&lt;/radG:GridButtonColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$ ConnectionStrings: NorthwindConnectionString %&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Fires when a detail-table in the hierarchy is about to be bound. You should only assign the DataSource property of the detail table to a data-source properly filtered to display ony child records related to the parent item.

C#
public event GridDetailTableDataBindEventHandler DetailTableDataBind

You can find the instance of the detail table in the event argument (e). You can find the parent item using e.DetailTable.ParentItem property.

Occurs when the Edit button is clicked for an item in the Telerik RadGrid control.

C#
public event GridCommandEventHandler EditCommand

The EditCommand event is raised when the Edit button is clicked for an item in the Telerik RadGrid control.

A typical handler for the EditCommand event edites the selected item from the data source.

Example:
C#
&lt;%@ Page Language="VB" /&gt; @ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;

Protected Sub RadGrid1_EditCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
Response.Write("Edit")
End Sub
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server" OnEditCommand="RadGrid1_EditCommand"  &gt;
&lt;MasterTableView&gt;
&lt;Columns&gt;
&lt;radG:GridEditCommandColumn&gt;
&lt;/radG:GridEditCommandColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
C#
[Obsolete("Please use ExportCellFormatting instead.")]
public event OnExcelExportCellFormattingEventHandler ExcelExportCellFormatting

Fires when a grid is exported to ExcelML and row is created.

C#
public event GridExcelMLExportRowCreatedEventHandler ExcelMLExportRowCreated

Fires when a grid is exported to ExcelML and styles collections is created.

C#
public event GridExcelMLExportStylesCreatedEventHandler ExcelMLExportStylesCreated

Fires when a grid is exported to ExcelML and WorkBook is created.

C#
public event EventHandler<GridExcelMLWorkBookCreatedEventArgs> ExcelMLWorkBookCreated

Fires when a grid is exporting.

C#
public event EventHandler<ExportCellFormattingEventArgs> ExportCellFormatting

Fires when the ListBox inside the filter item require DataSource. In this event you can add items to the ListBox using its Items collection. Or you can assign DataSource and call DataBind() for the ListBox.

C#
public event GridFilterCheckListItemsRequestedEventHandler FilterCheckListItemsRequested

Fires when a grid is exporting.

C#
public event OnGridExportingEventHandler GridExporting

Fires when a grouping action has been performed. For example when a column header was dragged in the GroupPanel.

C#
public event GridGroupsChangingEventHandler GroupsChanging

You can use this event to set your own GridGroupByExpression when the user tries to group the grid.

Example:
cs-api-definition
protected void RadGrid1_GroupsChanging(object source, Telerik.Web.UI.GridGroupsChangingEventArgs e)
{
//Expression is added (by drag/grop on group panel)

if (e.Action == GridGroupsChangingAction.Group)
{
if (e.Expression.GroupByFields[0].FieldName != "CustomerID")
{
GridGroupByField countryGroupField = new GridGroupByField();
countryGroupField.FieldName = "Country";
GridGroupByField cityGroupField = new GridGroupByField();
cityGroupField.FieldName = "City";

e.Expression.SelectFields.Clear();
e.Expression.SelectFields.Add(countryGroupField);
e.Expression.SelectFields.Add(cityGroupField);

e.Expression.GroupByFields.Clear();
e.Expression.GroupByFields.Add(countryGroupField);
e.Expression.GroupByFields.Add(cityGroupField);
}

}
}

Fires when a grid is exporting to Word or HTML Excel.

C#
public event EventHandler<GridHTMLExportingEventArgs> HTMLExporting

Fires when a grid is exporting to XLS BIFF, DOCX, or XLSX formats

C#
public event EventHandler<GridInfrastructureExportingEventArgs> InfrastructureExporting

Occurs when the Insert button is clicked for an item in the Telerik RadGrid control.

C#
public event GridCommandEventHandler InsertCommand

The InsertCommand event is raised when the Insert button is clicked for an item in the Telerik RadGrid control.

A typical handler for the InsertCommand event insert the item into the data source.

Example:
C#
&lt;%@ Page Language="VB" &gt; &lt;@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;


Protected Sub RadGrid1_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
Response.Write("Insert")
End Sub
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server" OnInsertCommand="RadGrid1_InsertCommand"   &gt;
&lt;MasterTableView CommandItemDisplay="TopAndBottom"&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Occurs when a button is clicked in a Telerik RadGrid control.

C#
public event GridCommandEventHandler ItemCommand

The ItemCommand event is raised when a button is clicked in the Telerik RadGrid control. This allows you to provide an event-handling method that performs a custom routine whenever this event occurs.

Buttons within a Telerik RadGrid control can also invoke some of the built-in functionality of the control. Fires if any control inside Telerik RadGrid rises a bubble event. This can be a command button (like Edit, Update button, Expand/Collapse of an items) The command arguemtn carries a reference to the item which rised the event, the command name and argument object.

A GridCommandEventArgs object is passed to the event-handling method, which allows you to determine the command name and command argument of the button clicked.

Example:
C#
&lt;%@ Page Language="VB" &lt;see cref="&gt; &lt;"/&gt;@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;


Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = GridItemType.Item Then
Dim item As Telerik.Web.UI.GridDataItem
item = e.Item
Dim LinkButton1 As LinkButton
LinkButton1 = item("LinkColumn").FindControl("LinkButton1")
LinkButton1.CommandArgument = e.Item.ItemIndex.ToString()
End If
End Sub

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
' If multiple buttons are used in a Telerik RadGrid control, use the
' CommandName property to determine which button was clicked.
If e.CommandName = "Add" Then

' Convert the row index stored in the CommandArgument
' property to an Integer.
Dim index As Integer = Convert.ToInt32(e.CommandArgument)

' Retrieve the item that contains the button clicked
' by the user from the Items collection.
Dim item As Telerik.Web.UI.GridDataItem = RadGrid1.Items(index)

' Create a new ListItem object for the customer in the item.
Dim nitem As New ListItem()
nitem.Text = Server.HtmlDecode(item("CustomerID").Text)

' If the customer is not already in the ListBox, add the ListItem
' object to the Items collection of the ListBox control.
If Not CustomersListBox.Items.Contains(nitem) Then

CustomersListBox.Items.Add(nitem)

End If

End If
End Sub
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server" OnItemCreated="RadGrid1_ItemCreated" OnItemCommand="RadGrid1_ItemCommand"&gt;
&lt;MasterTableView&gt;
&lt;Columns&gt;
&lt;radG:GridTemplateColumn
UniqueName="LinkColumn"
HeaderText="LinkColumn"&gt;
&lt;ItemTemplate&gt;
&lt;asp:LinkButton CommandName="Add" Text="click" ID="LinkButton1" runat="server"&gt;LinkButton&lt;/asp:LinkButton&gt;
&lt;/ItemTemplate&gt;
&lt;/radG:GridTemplateColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;asp:listbox id="CustomersListBox" runat="server"/&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;&lt;see cref="NorthwindConnectionString"&gt;$ ConnectionStrings&lt;/see&gt;&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Occurs when an item is created in a Telerik RadGrid control.

C#
public event GridItemEventHandler ItemCreated

Before the Telerik RadGrid control can be rendered, a GridItem object must be created for each row in the control. The ItemCreated event is raised when each row in the Telerik RadGrid control is created. This allows you to provide an event-handling method that performs a custom routine, such as adding custom content to a item, whenever this event occurs.

A GridItemEventArgs object is passed to the event-handling method, which allows you to access the properties of the row being created. You can determine which item type (header item, data pager item, and so on) is being bound by using the Item.ItemType property.

Note that the changes made to the item control and its children at this stage does not persist into the ViewState.

Example:
C#
&lt;%@ Page Language="VB" &gt; &lt;@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;


Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = GridItemType.Item Then
Dim item As Telerik.Web.UI.GridDataItem
item = e.Item
Dim LinkButton1 As LinkButton
LinkButton1 = item("LinkColumn").FindControl("LinkButton1")
LinkButton1.CommandArgument = e.Item.ItemIndex.ToString()
End If
End Sub

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
' If multiple buttons are used in a Telerik RadGrid control, use the
' CommandName property to determine which button was clicked.
If e.CommandName = "Add" Then

' Convert the row index stored in the CommandArgument
' property to an Integer.
Dim index As Integer = Convert.ToInt32(e.CommandArgument)

' Retrieve the item that contains the button clicked
' by the user from the Items collection.
Dim item As Telerik.Web.UI.GridDataItem = RadGrid1.Items(index)

' Create a new ListItem object for the customer in the item.
Dim nitem As New ListItem()
nitem.Text = Server.HtmlDecode(item("CustomerID").Text)

' If the customer is not already in the ListBox, add the ListItem
' object to the Items collection of the ListBox control.
If Not CustomersListBox.Items.Contains(nitem) Then

CustomersListBox.Items.Add(nitem)

End If

End If
End Sub
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server" OnItemCreated="RadGrid1_ItemCreated" OnItemCommand="RadGrid1_ItemCommand"&gt;
&lt;MasterTableView&gt;
&lt;Columns&gt;
&lt;radG:GridTemplateColumn
UniqueName="LinkColumn"
HeaderText="LinkColumn"&gt;
&lt;ItemTemplate&gt;
&lt;asp:LinkButton CommandName="Add" Text="click" ID="LinkButton1" runat="server"&gt;LinkButton&lt;/asp:LinkButton&gt;
&lt;/ItemTemplate&gt;
&lt;/radG:GridTemplateColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;asp:listbox id="CustomersListBox" runat="server"/&gt;
&lt;!-- This example uses Microsoft SQL Server and connects  --&gt;
&lt;!-- to the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression to retrieve the connection string value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString"&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Occurs when a data item is bound to data in a Telerik RadGrid control.

C#
public event GridItemEventHandler ItemDataBound

Before the Telerik RadGrid control can be rendered, each item in the control must be bound to a record in the data source. The ItemDataBound event is raised when a data item (represented by a GridItem object) is bound to data in the Telerik RadGrid control. This allows you to provide an event-handling method that performs a custom routine, such as modifying the values of the data bound to the item, whenever this event occurs.

A GridItemEventArgs object is passed to the event-handling method, which allows you to access the properties of the item being bound. You can determine which item type (header item, data pager item, and so on) is being bound by using the Item.ItemType property.

Note that the changes made to the item control and its children does persist into the ViewState. This event is fired as a result of a data-binding of Telerik RadGrid contorl. This event is fired for items of type:

  • GridDataItem
  • GridEditFormItem
  • GridHeaderItem
  • GridPagerItem
  • GridFooterItem
Example:
C#
&lt;%@ Page Language="VB"&gt; &lt;@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = GridItemType.Item Then
Dim item As Telerik.Web.UI.GridDataItem
item = e.Item
item("CustomerID").Text = "Telerik"
End If
End Sub
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server" OnItemDataBound="RadGrid1_ItemDataBound"&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Fires when an automatic delete operation is executed.

C#
public event GridDeletedEventHandler ItemDeleted

Fires when various item events occur - for example, before Pager item is initialized, before EditForm is initialized, etc.

C#
public event GridItemEventHandler ItemEvent

Fires when an automatic insert operation is executed.

C#
public event GridInsertedEventHandler ItemInserted

Fires when an automatic update operation is executed.

C#
public event GridUpdatedEventHandler ItemUpdated

Fires when the grid is about to be bound and the data source must be assigned (is null/Nothing).

C#
public event GridNeedDataSourceEventHandler NeedDataSource

Using this event eliminates the need for calling DataBind() when the grid content should be refreshed, due to a structural change.
For example if Edit command bubbles, grid will automatically rebind and display the item in edit mode, with no additional code.

Note that when you use NeedDataSource you need to assign manually the DataSource property only once in the event handler!

Important: You should never call Rebind() method in NeedDataSource event handler or DataBind() for the grid at any stage of the page lifecycle!

For more information related to Advanced Data Binding (i.e. with NeedDataSource) see the following Data binding article.

Fires when a paging action has been performed.

C#
public event GridPageChangedEventHandler PageIndexChanged

Fires when PageSize property value has been changed.

C#
public event GridPageSizeChangedEventHandler PageSizeChanged

The PageSizeChanged event is rised when the value of the property PageSize is changed. You can cancel the event if the new PageSize value is invalid and it will not be saved. For example:

            protected void RadGrid1_PageSizeChanged(object source, GridPageSizeChangedEventArgs e)
{
if(e.NewPageSize < 1)
e.Canceled = true;
}

Fires when a grid is exporting.

C#
public event OnGridPdfExportingEventHandler PdfExporting

Fires when one or more data items are dragged and dropped within the grid or onto an external HTML element.

C#
public event GridDragDropEventHandler RowDrop

Occurs when a column is sorted.

C#
public event GridSortCommandEventHandler SortCommand

The SortCommand event is raised when a column is sorted.

A typical handler for the SortCommand event sorts the list.

Example:
C#
&lt;%@ Page Language="VB" &gt; &lt;@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;

Protected Sub RadGrid1_SortCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridSortCommandEventArgs)
Response.Write("Sort")
End Sub
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1" AllowSorting="true"
runat="server" OnSortCommand="RadGrid1_SortCommand" &gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Occurs when the Update button is clicked for an item in the Telerik RadGrid control.

C#
public event GridCommandEventHandler UpdateCommand

The UpdateCommand event is raised when the Update button is clicked for an item in the Telerik RadGrid control.

A typical handler for the UpdateCommand event updates the selected item from the data source.

Example:
C#
&lt;%@ Page Language="VB" &gt; &lt;@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %&gt;

&lt;!DOCTYPE html Public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;script runat="server"&gt;

Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
Response.Write("Update")
End Sub
&lt;/script&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
&lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;radG:RadGrid
DataSourceID="SqlDataSource1"
ID="RadGrid1"
runat="server" OnUpdateCommand="RadGrid1_UpdateCommand"  &gt;
&lt;MasterTableView&gt;
&lt;Columns&gt;
&lt;radG:GridEditCommandColumn&gt;
&lt;/radG:GridEditCommandColumn&gt;
&lt;/Columns&gt;
&lt;/MasterTableView&gt;
&lt;/radG:RadGrid&gt;
&lt;!-- This example uses Microsoft SQL Server And connects  --&gt;
&lt;!-- To the Northwind sample database. Use an ASP.NET     --&gt;
&lt;!-- expression To retrieve the connection String value   --&gt;
&lt;!-- from the Web.config file.                            --&gt;
&lt;asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="&lt;%$NorthwindConnectionString&gt;"
SelectCommand="SELECT TOP 5 [CustomerID], [ContactName], [CompanyName] FROM [Customers]"&gt;
&lt;/asp:SqlDataSource&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
In this article
DefinitionConstructorsRadGrid()FieldsBatchEditCommandNameCancelAllCommandNameCancelCommandNameClearFilterCommandNameClearSortCommandNameDeleteCommandNameDeleteSelectedCommandNameDeselectCommandNameDownloadAttachmentCommandNameEditAllCommandNameEditCommandNameEditSelectedCommandNameExpandCollapseAllCommandNameExpandCollapseCommandNameExportToCsvCommandNameExportToExcelCommandNameExportToPdfCommandNameExportToWordCommandNameFilterCommandNameFirstPageCommandArgumentGroupsCustomExpandCollapseCommandNameGroupsExpandAllCommandNameHeaderContextMenuFilterCommandNameHeaderSortCommandNameInitInsertCommandNameLastPageCommandArgumentNextPageCommandArgumentPageCommandNamePerformInsertCommandNamePrevPageCommandArgumentRebindGridCommandNameSelectCommandNameSortCommandNameUpdateCommandNameUpdateEditedCommandNamePropertiesActiveItemStyleAllowAutomaticDeletesAllowAutomaticInsertsAllowAutomaticUpdatesAllowCustomPagingAllowFilteringByColumnAllowMultiRowEditAllowMultiRowSelectionAllowPagingAllowSortingAlternatingItemStyleAutoGenerateColumnsAutoGenerateDeleteColumnAutoGenerateEditColumnAutoGenerateHierarchyBackImageUrlClientDataSourceIDClientSettingsColumnsCommandItemStyleCultureCurrentPageIndexDataMemberDataModelIDDataSourceDataSourceIDDeleteMethodEditIndexesEditItemsEditItemStyleEnableAriaSupportEnableGroupsExpandAllEnableHeaderContextAggregatesMenuEnableHeaderContextFilterMenuEnableHeaderContextMenuEnableHierarchyExpandAllEnableLinqExpressionsEnableViewStateExportSettingsFilterItemStyleFilterMenuFilterTypeFooterStyleGroupHeaderItemStyleGroupingEnabledGroupingSettingsGroupPanelGroupPanelPositionHeaderContextMenuHeaderStyleHierarchySettingsImagesPathInsertMethodIsBoundUsingODataIsExportingItemsItemStyleLocalizationPathMasterTableViewMultiHeaderItemStyleODataDataSourceIDPageCountPagerStylePageSizeRetainExpandStateOnRebindSelectedCellIndexesSelectedCellsSelectedIndexesSelectedItemsSelectedItemStyleSelectedValueSelectedValuesSelectMethodShowFooterShowGroupPanelShowHeaderShowStatusBarSkinSortHeaderContextMenuColumnsSortingSettingsStatusBarSettingsSupportsRenderingModeUpdateMethodValidationSettingsVirtualItemCountWidthMethodsBrowserIsCrawler()ControlPreRender()CreateButton(string, bool)CreateButton(string, string, bool)CreateChildControls(IEnumerable, bool)CreateTableView()DataBind()DescribeComponent(IScriptDescriptor)ExportToCsv()ExportToExcel()ExportToExcel(GridExcelExportFormat)ExportToPdf()ExportToWord()ExportToWord(GridWordExportFormat)GetBindingData(IQueryable, int, int, string, string)GetBindingData(string, string, int, int, string, string)GetBindingData(string, string, string, int, int, string, string)GetBindingData<T>(IQueryable<T>, int, int, string, string)GetCallbackResult()GetData()GetScriptReferences()GetSkinSuffix()GetSPViewFieldValue<T>(T, string)headerContextMenu_ItemClick(object, RadMenuEventArgs)LoadClientState(Dictionary<string, object>)LoadViewState(object)OnBatchEditCommand(GridBatchEditingEventArgs)OnBiffExporting(GridBiffExportingEventArgs)OnBubbleEvent(object, EventArgs)OnCancelCommand(GridCommandEventArgs)OnColumnCreated(GridColumnCreatedEventArgs)OnColumnCreating(GridColumnCreatingEventArgs)OnCreateColumnEditor(GridCreateColumnEditorEventArgs)OnCustomAggregate(GridCustomAggregateEventArgs)OnDataBound(EventArgs)OnDataSourceViewChanged(object, EventArgs)OnDeleteCommand(GridCommandEventArgs)OnDetailTableDataBind(GridDetailTableDataBindEventArgs)OnEditCommand(GridCommandEventArgs)OnExcelExportCellFormatting(ExcelExportCellFormattingEventArgs)OnExcelMLExportRowCreated(GridExportExcelMLRowCreatedArgs)OnExcelMLExportStylesCreated(GridExportExcelMLStyleCreatedArgs)OnExcelMLWorkBookCreated(GridExcelMLWorkBookCreatedEventArgs)OnExportCellFormatting(ExportCellFormattingEventArgs)OnFieldDescriptorsReady(RadFilterFildDesciptorsEventArgs)OnFilterCheckListItemsRequested(GridFilterCheckListItemsRequestedEventArgs)OnGridExporting(GridExportingArgs)OnGroupsChanging(GridGroupsChangingEventArgs)OnHTMLExporting(GridHTMLExportingEventArgs)OnInfrastructureExporting(GridInfrastructureExportingEventArgs)OnInit(EventArgs)OnInsertCommand(GridCommandEventArgs)OnItemCommand(GridCommandEventArgs)OnItemCreated(GridItemEventArgs)OnItemDataBound(GridItemEventArgs)OnItemDeleted(GridDeletedEventArgs)OnItemEvent(GridItemEventArgs)OnItemInserted(GridInsertedEventArgs)OnItemUpdated(GridUpdatedEventArgs)OnLoad(EventArgs)OnNeedDataSource(GridNeedDataSourceEventArgs)OnPageIndexChanged(GridPageChangedEventArgs)OnPageSizeChanged(GridPageSizeChangedEventArgs)OnPdfExporting(GridPdfExportingArgs)OnRowDropEvent(IList<GridDataItem>, GridDataItem, RadGrid, GridItemDropPosition, GridTableView)OnRowDropEvent(IList<GridDataItem>, string)OnSortCommand(GridSortCommandEventArgs)OnUpdateCommand(GridCommandEventArgs)ParseSPViewFieldsIntoDataColumns<T>(T)PrepareControlHierarchy()RaiseCallbackEvent(string)RaisePostDataChangedEvent()Rebind()RenderContents(HtmlTextWriter)SaveViewState()TrackViewState()EventsBatchEditCommandBiffExportingCancelCommandColumnCreatedColumnCreatingColumnsReorderCreateColumnEditorCustomAggregateDeleteCommandDetailTableDataBindEditCommandExcelExportCellFormattingExcelMLExportRowCreatedExcelMLExportStylesCreatedExcelMLWorkBookCreatedExportCellFormattingFilterCheckListItemsRequestedGridExportingGroupsChangingHTMLExportingInfrastructureExportingInsertCommandItemCommandItemCreatedItemDataBoundItemDeletedItemEventItemInsertedItemUpdatedNeedDataSourcePageIndexChangedPageSizeChangedPdfExportingRowDropSortCommandUpdateCommand
Not finding the help you need?
Contact Support