New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Server-Side Programming Overview

For a list with the server-side properties and methods of the control, see the Server-Side API of the RadGrid class. You can also find it in the intellisense in Visual Studio.

For instructions and examples for a server-side approach to access Cells, Values, Controls and more in RadGrid, visit the: Accessing Values and Controls article.

Classes and Properties

Following is a table of the most important properties you should be aware of when working with RadGrid.

PropertyDescription
RadGrid.MasterTableViewThe main grid table - in the general case, when there is no hierarchy, only RadGrid.MasterTableView is rendered. You can think of this table as if it is the grid itself. MasterTableView and generally all table-views in the hierarchy use the style, client behavior and other settings applied to RadGrid , unless explicitly specified otherwise.
GridTableView.DetailTablesThis collection is used for defining the hierarchical structure of RadGrid .
RadGrid.ClientSettingsSet various client-side appearance and behavior options. See RadGridTable client-side API for details.
*RadGrid.StyleProperties that control the visual appearance of RadGrid and all tables in the hierarchy.
*GridDataTable.Style propertiesProperties that control the visual appearance of GridDataTable and all tables in the hierarchy.
GridTableView.ColumnGroupsA collection of type GridColumnGroupCollection which holds the multiheaders in the GridTableView
GridTableView.GroupByExpressionsAdd or remove objects to this collection to set grouping programmatically.
GridTableView.SortExpressionsAdd or remove objects to this collection to set sorting programmatically.
GridTableView.Columns , GridTableView.AutoGeneratedColumns , GridTableView.RenderColumnsProperties to access runtime columns. Columns are set by default in design mode. AutoGeneratedColumns - are automatically generated columns RenderColumns - all columns - columns+ AutoGenerated (if any) + structure columns - expand/collapse and group-splitters

Instead of setting properties for each GridTableView, you can use RadGrid global properties for: PageSize, AllowSorting, AllowPaging, AllowCustomPaging, ShowFooter, ShowHeader, BackColor, BorderColor, PagerStyle. Thus they will be set for each table in the hierarchy, unless specified otherwise.

Events

When working with Telerik RadGrid you will probably often use the following events (sorted by categories).

Command events

  • CancelCommand

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

  • DeleteCommand

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

  • EditCommand

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

  • UpdateCommand

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

  • InsertCommand

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

  • ItemCommand

    Fired when any button is clicked in the RadGrid control. All bubbled events from grid items fire RadGrid.ItemCommand . Those like - Edit, Delete, or Update command events can be used

  • BatchEditCommand

    Fired when saving the changes if the data is bound on the server and the EditMode of the Grid is set to Batch.

  • SortCommand

Behavior

  • ItemCreated

    Fired on the server when an item in the RadGrid control is created.

  • ItemDataBound

    Fired after an item is databound to the RadGrid control.

  • PageIndexChanged

    Fired when one of the page selection elements is clicked.

  • PageSizeChanged

    Fired when the page size is changed through the advanced pager or manually in code

  • SelectedIndexChanged (inherited from GridBaseDataList )

    Fired when a different item is selected in a data listing control between posts to the server.

  • ItemEvent

    Marked for internal usage.

  • ColumnCreated

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

  • ColumnCreating

    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

  • GroupsChanging

    Fired when Telerik RadGrid tries to group its data (e.g. when a column header is dragged to the Group Panel).

  • CreateColumnEditor

    Fired -after- the NeedDataSource event of the grid (which is raised right after the PageLoad event) and -before- any postback events for controls on the page/user control.

  • ColumnsReorder

    Fired when column reorder occurs (only when ClientSettings -> ReorderColumnsOnClient is set to false!)

Data binding

Automatic CRUD operations with Declarative DataSource controls

  • ItemDeleted

    Fired when an automatic delete operation is executed.

  • ItemUpdated

    Fired when an automatic update operation is executed.

  • ItemInserted

    Fired when an automatic insert operation is executed.

Row Drag&Drop

  • RowDrop

    Fired when drag and drop operation is triggered from the client

Exporting

  • OnGridExporting

    Fired when RadGrid is exported to Excel/Word/Csv/Pdf before the resulting document is rendered on the client.

  • OnPdfExporting

    Fired when RadGrid is exported to Pdf before the resulting document is rendered on the client. Appropriate for customizing the grid table appearance in the .pdf document.

  • OnExcelExportCellFormatting

    Fired when RadGrid is exported to Excel before the resulting document is rendered on the client.

  • OnExcelMLExportStylesCreated

    Fired when RadGrid is exported to native Excel before the OnExcelMLExportRowCreated event.

  • OnExcelMLExportRowCreated

    Fired when RadGrid is exported to native Excel before the resulting document is rendered on the client.

Miscellanious

See Also