RadGrid
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:
[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:
Inherited Members
Constructors
Constructs a new instance of RadGrid
public RadGrid()
Fields
public const string BatchEditCommandName = "BatchEdit"
public const string CancelAllCommandName = "CancelAll"
Represents the Cancel command name. This field is read-only.
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.
public const string ClearFilterCommandName = "ClearFilter"
public const string ClearSortCommandName = "ClearSort"
Represents the "Delete" command name. This field is read-only.
public const string DeleteCommandName = "Delete"
Use the DeleteCommandName field to represent the "Delete" command name.
Represents the "DeleteSelected" command name. This field is read-only.
public const string DeleteSelectedCommandName = "DeleteSelected"
Use the DeleteSelectedCommandName field to represent the "DeleteSelected" command name.
public const string DeselectCommandName = "Deselect"
Represents the "DownloadAttachment" command name. This field is read-only.
public const string DownloadAttachmentCommandName = "DownloadAttachment"
Use the DownloadAttachment field to represent the "DownloadAttachment" command name.
public const string EditAllCommandName = "EditAll"
Represents the "Edit" command name. This field is read-only.
public const string EditCommandName = "Edit"
Use the EditCommandName field to represent the "Edit" command name. This command enters RadGrid in edit mode.
public const string EditSelectedCommandName = "EditSelected"
public const string ExpandCollapseAllCommandName = "ExpandCollapseAll"
public const string ExpandCollapseCommandName = "ExpandCollapse"
public const string ExportToCsvCommandName = "ExportToCsv"
public const string ExportToExcelCommandName = "ExportToExcel"
public const string ExportToPdfCommandName = "ExportToPdf"
public const string ExportToWordCommandName = "ExportToWord"
public const string FilterCommandName = "Filter"
public const string FirstPageCommandArgument = "First"
public const string GroupsCustomExpandCollapseCommandName = "GroupsCustomExpandCollapse"
public const string GroupsExpandAllCommandName = "GroupsExpandAll"
Represents the name of the filter command fired through RadGrid's header context menu.
public const string HeaderContextMenuFilterCommandName = "HeaderContextMenuFilter"
public const string HeaderSortCommandName = "HeaderSort"
Represents the "InitInsert" command name. This field is read-only.
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.
public const string LastPageCommandArgument = "Last"
public const string NextPageCommandArgument = "Next"
public const string PageCommandName = "Page"
Represents the "PerformInsert" command name. This field is read-only.
public const string PerformInsertCommandName = "PerformInsert"
Use the PerformInsertCommandName field to represent the "PerformInsert" command name. This command enters the new record into the database.
public const string PrevPageCommandArgument = "Prev"
Represents the "RebindGrid" command name. This field is read-only. Forces RadGrid.Rebind
public const string RebindGridCommandName = "RebindGrid"
Use the RebindGridCommandName field to force rebinding the grid.
public const string SelectCommandName = "Select"
public const string SortCommandName = "Sort"
Represents the "Update" command name. This field is read-only.
public const string UpdateCommandName = "Update"
Use the UpdateCommandName field to represent the "Update" command name.
Represents the "UpdateEdited" command name. Updates all items that are in edit mode. This field is read-only.
public const string UpdateEditedCommandName = "UpdateEdited"
Use the UpdateCommandName field to represent the "Update" command name.
Properties
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the active item in a Telerik RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle ActiveItemStyle { get; }
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.
Gets or sets a value indicating whether Telerik RadGrid will automatically delete records from the specified data source.
public bool AllowAutomaticDeletes { get; set; }
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.
public bool AllowAutomaticInserts { get; set; }
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.
public bool AllowAutomaticUpdates { get; set; }
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.
public virtual bool AllowCustomPaging { get; set; }
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.
public virtual bool AllowFilteringByColumn { get; set; }
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.
public bool AllowMultiRowEdit { get; set; }
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.
public bool AllowMultiRowSelection { get; set; }
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.
public virtual bool AllowPaging { get; set; }
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.
Gets or sets a value indicating whether the sorting feature is enabled.
public virtual bool AllowSorting { get; set; }
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.
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of alternating data items in a Telerik RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle AlternatingItemStyle { get; }
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.
Gets or sets a value indicating whether bound fields are automatically created for each field in the data source.
public virtual bool AutoGenerateColumns { get; set; }
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.
Gets or sets a value determining if RadGrid will automatically generate a GridButtonColumn with CommandName set to 'Delete'.
public virtual bool AutoGenerateDeleteColumn { get; set; }
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.
public virtual bool AutoGenerateEditColumn { get; set; }
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.
public virtual bool AutoGenerateHierarchy { get; set; }
Gets or sets the URL to an image to display in the background of a Telerik RadGrid control.
[Bindable(true)]
public virtual string BackImageUrl { get; set; }
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
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridClientSettings ClientSettings { get; }
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.
Gets a collection (GridColumnCollection) of all columns in Telerik RadGrid.
[Browsable(false)]
public virtual GridColumnCollection Columns { get; }
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.
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the command item in a Telerik RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle CommandItemStyle { get; }
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.
Gets or sets the selected culture. Localization strings will be loaded based on this value.
public CultureInfo Culture { get; set; }
The selected culture. Localization strings will be loaded based on this value.
Gets or sets an integer value representing the current page index.
[Bindable(true)]
[Browsable(false)]
public int CurrentPageIndex { get; set; }
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.
public override string DataMember { get; set; }
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:
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.
public virtual string DataModelID { get; set; }
The OData service DataModelID.
Gets or sets the object from which the Telerik RadGrid control retrieves its list of data items.
[Bindable(true)]
[Browsable(false)]
public override object DataSource { get; set; }
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:
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.
Gets or sets the ID of the control from which the Telerik RadGrid control retrieves its list of data items.
[Themeable(false)]
public override string DataSourceID { get; set; }
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:
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.
Gets or sets the name of the method to call in order to delete data
public string DeleteMethod { get; set; }
Gets a collection of the indexes of the Items that are in edit mode.
[Browsable(false)]
public GridIndexCollection EditIndexes { get; }
returns GridIndexCollection of all data items that are in edit mode.
Gets a collection of all GridItems in edit mode. See the Remarks for more info.
[Browsable(false)]
public GridItemCollection EditItems { get; }
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle EditItemStyle { get; }
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.
When set to true enables support for WAI-ARIA
public bool EnableAriaSupport { get; set; }
Gets or sets a value indicating whether the groups expand/collapse all header buttons should be switched on.
public virtual bool EnableGroupsExpandAll { get; set; }
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.
public virtual bool EnableHeaderContextAggregatesMenu { get; set; }
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.
public virtual bool EnableHeaderContextFilterMenu { get; set; }
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.
public virtual bool EnableHeaderContextMenu { get; set; }
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.
public virtual bool EnableHierarchyExpandAll { get; set; }
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.
public virtual bool EnableLinqExpressions { get; set; }
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.
public override bool EnableViewState { get; set; }
true if the server control maintains its view state; otherwise false. The default is true.
Overrides:
Gets a reference to the GridExportSettings object that allows you to set the properties of the grouping operation in a Telerik RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridExportSettings ExportSettings { get; }
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle FilterItemStyle { get; }
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.
Gets a reference to GridFilterMenu object. The filtering menu appears when the filter button on the GridFilteringItem is clicked.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridFilterMenu FilterMenu { get; }
returns a reference to GridFilterMenu object.
This property is meaningful only when you have filtering enabled (by setting AllowFilteringByColumn="true").
Change the filter type displayed in the filter dropdown
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle FooterStyle { get; }
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.
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the group-header item in a Telerik RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle GroupHeaderItemStyle { get; }
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.
Gets or sets a value indicating whether the grouping is enabled.
[Bindable(true)]
public virtual bool GroupingEnabled { get; set; }
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridGroupingSettings GroupingSettings { get; }
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.
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.
[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
[Bindable(true)]
public virtual GridGroupPanelPosition GroupPanelPosition { get; set; }
Represents a HeaderContextMenu
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridHeaderContextMenu HeaderContextMenu { get; }
Gets the style properties of the heading section in the RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle HeaderStyle { get; }
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.
Gets a reference to the GridHierarchySettings object that allows you to set the properties of the hierarchical Telerik RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridHierarchySettings HierarchySettings { get; }
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.
Gets or sets default path for the grid images.
public virtual string ImagesPath { get; set; }
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
public string InsertMethod { get; set; }
protected virtual bool IsBoundUsingOData { get; }
This property returns true when the control is currently exporting a file
[Browsable(false)]
public bool IsExporting { get; }
Gets a collection of all GridDataItems.
[Browsable(false)]
public virtual GridDataItemCollection Items { get; }
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle ItemStyle { get; }
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.
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.
public string LocalizationPath { get; set; }
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
[Bindable(false)]
public virtual GridTableView MasterTableView { get; }
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.
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the MultiHeader item in a Telerik RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle MultiHeaderItemStyle { get; }
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.
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.
[Browsable(false)]
public int PageCount { get; }
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.
Gets a reference to the GridPagerStyle object that allows you to set the appearance of the page item in a Telerik RadGrid control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridPagerStyle PagerStyle { get; }
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.
Gets or sets an integer value indicating the number of Items that a single page in Telerik RadGrid will contain.
public virtual int PageSize { get; set; }
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 a collection of indexes of the selected items.
[Browsable(false)]
public GridIndexCollection SelectedCellIndexes { get; }
returns GridIndexCollection of the indexes of all selected Items.
Gets a collection of the currently selected GridTableCells
[Browsable(false)]
public GridTableCellCollection SelectedCells { get; }
Returns a GridTableCellCollection of all selected cells.
Gets a collection of indexes of the selected items.
[Browsable(false)]
public GridIndexCollection SelectedIndexes { get; }
returns GridIndexCollection of the indexes of all selected Items.
Gets a collection of the currently selected GridDataItems
[Browsable(false)]
public GridItemCollection SelectedItems { get; }
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle SelectedItemStyle { get; }
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.
Gets the data key value of the selected row in a RadGrid control.
[Browsable(false)]
public object SelectedValue { get; }
The data key value of the selected row in a RadGrid control.
Gets the corresponding data key values for the selected items in the grid.
[Browsable(false)]
public DataKey SelectedValues { get; }
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
public override string SelectMethod { get; set; }
Overrides:
Gets or set a value indicating whether the footer item of the grid will be shown.
[Bindable(true)]
public virtual bool ShowFooter { get; set; }
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.
[Bindable(true)]
public virtual bool ShowGroupPanel { get; set; }
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.
[Bindable(true)]
public virtual bool ShowHeader { get; set; }
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.
[Bindable(true)]
public virtual bool ShowStatusBar { get; set; }
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
public override string Skin { get; set; }
The name of the skin as String.
Overrides:
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.
public virtual bool SortHeaderContextMenuColumns { get; set; }
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridSortingSettings SortingSettings { get; }
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.
Gets a GridStatusBarItemSettings object that contains variable settings related to the status bar.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridStatusBarItemSettings StatusBarSettings { get; }
returns a reference to GridStatusBarItemSettings object.
protected override bool SupportsRenderingMode { get; }
Overrides:
Gets or sets the name of the method to call in order to update data
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.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridValidationSettings ValidationSettings { get; }
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.
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.
[Browsable(true)]
[Bindable(true)]
public virtual int VirtualItemCount { get; set; }
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.
public override Unit Width { get; set; }
A Unit that represents the width of the control. The default is Empty.
Exceptions: ArgumentExceptionThe width of the Web server control was set to a negative value.
Overrides:
Methods
Code moved into this method from OnPreRender to make sure it executed when the framework skips OnPreRender() for some reason
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
protected override void ControlPreRender()
Overrides:
Creates a RadGrid action button with a font icon and optional text.
Creates a RadGrid action button with a font icon and custom text.
public static HtmlGenericControl CreateButton(string name, string text, bool display = true)
The action name used to build CSS classes.
textstringThe button text and title.
displayboolWhether the button should be initially visible.
Returns:An HtmlGenericControl representing a button element.
protected override int CreateChildControls(IEnumerable dataSource, bool dataBinding)
Overrides:
This method is used by RadGrid internally. Please do not use.
Data-bind %MasterTableView% and its detail %GridTableView%s. Prior to calling DataBind, the %DataSource% property should be assigned.
public override void DataBind()
Overrides:
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.
protected override void DescribeComponent(IScriptDescriptor descriptor)
Overrides:
Exports RadGrid to Csv format
public void ExportToCsv()
Exports RadGrid to Excel format
public void ExportToExcel()
Exports RadGrid to the given Excel format
public void ExportToExcel(GridExcelExportFormat format)
Excel format
Exports RadGrid to Pdf format
public void ExportToPdf()
Exports RadGrid to Word format
public void ExportToWord()
Exports RadGrid to the given Word format
public void ExportToWord(GridWordExportFormat format)
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
public static GridLinqBindingData GetBindingData(IQueryable source, int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
IQueryable collection to be paged, filtered and sorted.
startRowIndexintThe index from where to start retrieving records. The parameter is used for pagging support.
maximumRowsintThe maximum rows to be loaded. The parameter is used for pagging support.
sortExpressionstringThe sort expression.
filterExpressionstringThe filter expression.
Returns: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
public static GridBindingData GetBindingData(string contextTypeName, string tableName, int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
The contextTypeName parameter for the GridLinqDataSource.
tableNamestringThe tableName parameter for the GridLinqDataSource.
startRowIndexintThe index from where to start retrieving records. The parameter is used for pagging support.
maximumRowsintThe maximum rows to be loaded. The parameter is used for pagging support.
sortExpressionstringThe sort expression.
filterExpressionstringThe filter expression.
Returns: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
public static GridBindingData GetBindingData(string contextTypeName, string tableName, string select, int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
The contextTypeName parameter for the GridLinqDataSource.
tableNamestringThe tableName parameter for the GridLinqDataSource.
selectstringThe select for the GridLinqDataSource.
startRowIndexintThe index from where to start retrieving records. The parameter is used for pagging support.
maximumRowsintThe maximum rows to be loaded. The parameter is used for pagging support.
sortExpressionstringThe sort expression.
filterExpressionstringThe filter expression.
Returns: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
public static GridLinqBindingData<T> GetBindingData<T>(IQueryable<T> source, int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
Generic IQueryable<T> collection to be paged, filtered and sorted.
startRowIndexintThe index from where to start retrieving records. The parameter is used for pagging support.
maximumRowsintThe maximum rows to be loaded. The parameter is used for pagging support.
sortExpressionstringThe sort expression.
filterExpressionstringThe filter expression.
Returns:Returns a GridBindingData object which could be used to return the data to the RadGrid control.
protected override IEnumerable<ScriptReference> GetScriptReferences()
Overrides:
protected void headerContextMenu_ItemClick(object sender, RadMenuEventArgs e)
Loads the client state data
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
protected override bool LoadClientState(Dictionary<string, object> clientState)
Overrides:
protected override void LoadViewState(object savedStateObject)
Overrides:
protected virtual void OnBatchEditCommand(GridBatchEditingEventArgs e)
protected virtual void OnBiffExporting(GridBiffExportingEventArgs e)
protected virtual void OnColumnCreated(GridColumnCreatedEventArgs e)
protected virtual void OnColumnCreating(GridColumnCreatingEventArgs e)
protected virtual void OnCreateColumnEditor(GridCreateColumnEditorEventArgs e)
protected virtual void OnCustomAggregate(GridCustomAggregateEventArgs e)
protected virtual void OnDetailTableDataBind(GridDetailTableDataBindEventArgs e)
protected virtual void OnExcelExportCellFormatting(ExcelExportCellFormattingEventArgs e)
protected virtual void OnExcelMLExportRowCreated(GridExportExcelMLRowCreatedArgs e)
protected virtual void OnExcelMLExportStylesCreated(GridExportExcelMLStyleCreatedArgs e)
protected virtual void OnExcelMLWorkBookCreated(GridExcelMLWorkBookCreatedEventArgs e)
protected virtual void OnExportCellFormatting(ExportCellFormattingEventArgs e)
protected virtual void OnFieldDescriptorsReady(RadFilterFildDesciptorsEventArgs e)
protected virtual bool OnFilterCheckListItemsRequested(GridFilterCheckListItemsRequestedEventArgs e)
protected virtual void OnGroupsChanging(GridGroupsChangingEventArgs e)
protected virtual void OnHTMLExporting(GridHTMLExportingEventArgs e)
protected virtual void OnInfrastructureExporting(GridInfrastructureExportingEventArgs e)
protected virtual bool OnNeedDataSource(GridNeedDataSourceEventArgs e)
protected virtual void OnPageIndexChanged(GridPageChangedEventArgs e)
protected virtual void OnPageSizeChanged(GridPageSizeChangedEventArgs e)
protected virtual void OnRowDropEvent(IList<GridDataItem> draggedItems, GridDataItem destinationItem, RadGrid parentGrid, GridItemDropPosition dropPosition, GridTableView destinationItemTableView)
protected virtual void OnRowDropEvent(IList<GridDataItem> draggedItems, string htmlElementId)
protected virtual void OnSortCommand(GridSortCommandEventArgs e)
Used by the SPRadGrid control
protected virtual List<DataColumn> ParseSPViewFieldsIntoDataColumns<T>(T firstObject)
protected override void PrepareControlHierarchy()
Overrides:
Executed when post data changes should invoke a changed event
protected override void RaisePostDataChangedEvent()
Overrides:
Forces RadGrid to fire NeedDataSource event then calls DataBind.
public virtual void Rebind()
protected override void RenderContents(HtmlTextWriter writer)
Overrides:
protected override void TrackViewState()
Overrides:
Events
The event which is fired when a batch edit operation is made.
public event GridBatchEditEventHandler BatchEditCommand
Fires when a grid is exporting to BIFF format
public event EventHandler<GridBiffExportingEventArgs> BiffExporting
Occurs when the Cancel button is clicked for an item in the Telerik RadGrid control.
public event GridCommandEventHandler CancelCommand
The CancelCommand event is raised when the Cancel button is clicked for an item in the Telerik RadGrid control.
This event is fired after the creation of auto-generated columns.
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.
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.
public event GridColumnsReorderEventHandler ColumnsReorder
Fires when each editable column creates its column editor, prior to initializing its controls in the cells of the grid
public event GridCreateColumnEditorEventHandler CreateColumnEditor
public event GridCustomAggregateEventHandler CustomAggregate
Occurs when the Delete button is clicked for an item in the Telerik RadGrid control.
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.
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.
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.
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.
[Obsolete("Please use ExportCellFormatting instead.")]
public event OnExcelExportCellFormattingEventHandler ExcelExportCellFormatting
Fires when a grid is exported to ExcelML and row is created.
public event GridExcelMLExportRowCreatedEventHandler ExcelMLExportRowCreated
Fires when a grid is exported to ExcelML and styles collections is created.
public event GridExcelMLExportStylesCreatedEventHandler ExcelMLExportStylesCreated
Fires when a grid is exported to ExcelML and WorkBook is created.
public event EventHandler<GridExcelMLWorkBookCreatedEventArgs> ExcelMLWorkBookCreated
Fires when a grid is exporting.
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.
public event GridFilterCheckListItemsRequestedEventHandler FilterCheckListItemsRequested
Fires when a grid is exporting.
public event OnGridExportingEventHandler GridExporting
Fires when a grouping action has been performed. For example when a column header was dragged in the GroupPanel.
public event GridGroupsChangingEventHandler GroupsChanging
You can use this event to set your own GridGroupByExpression when the user tries to group the grid.
Fires when a grid is exporting to Word or HTML Excel.
public event EventHandler<GridHTMLExportingEventArgs> HTMLExporting
Fires when a grid is exporting to XLS BIFF, DOCX, or XLSX formats
public event EventHandler<GridInfrastructureExportingEventArgs> InfrastructureExporting
Occurs when the Insert button is clicked for an item in the Telerik RadGrid control.
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.
Occurs when a button is clicked in a Telerik RadGrid control.
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.
Occurs when an item is created in a Telerik RadGrid control.
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.
Occurs when a data item is bound to data in a Telerik RadGrid control.
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
Fires when an automatic delete operation is executed.
public event GridDeletedEventHandler ItemDeleted
Fires when various item events occur - for example, before Pager item is initialized, before EditForm is initialized, etc.
public event GridItemEventHandler ItemEvent
Fires when an automatic insert operation is executed.
public event GridInsertedEventHandler ItemInserted
Fires when an automatic update operation is executed.
public event GridUpdatedEventHandler ItemUpdated
Fires when the grid is about to be bound and the data source must be assigned (is null/Nothing).
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.
public event GridPageChangedEventHandler PageIndexChanged
Fires when PageSize property value has been changed.
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.
public event OnGridPdfExportingEventHandler PdfExporting
Fires when one or more data items are dragged and dropped within the grid or onto an external HTML element.
public event GridDragDropEventHandler RowDrop
Occurs when a column is sorted.
public event GridSortCommandEventHandler SortCommand
The SortCommand event is raised when a column is sorted.
A typical handler for the SortCommand event sorts the list.
Occurs when the Update button is clicked for an item in the Telerik RadGrid control.
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.
