GridItem
Class that represents the rows of each GridTableView with RadGrid. All Items in RadGrid inherit from this class. RadGrid creates the items runtime, when it binds to data.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
public abstract class GridItem : GridTableRow, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, INamingContainer
Inheritance: objectControlWebControlTableRowGridTableRowGridItem...
Derived Classes:
Implements:
Inherited Members
Constructors
Initializes the base properties of an item.
public GridItem(GridTableView ownerTableView, int itemIndex, int dataSetIndex, GridItemType itemType)
Properties
Gets a value indicating whether the item can be "expanded" to show its child items
public virtual bool CanExpand { get; }
The original DataItem from the DataSource. See examples section below.
public virtual object DataItem { get; set; }
Gets the index of the GridDataItem in the underlying DataTable/specified table from a DataSet.
public virtual int DataSetIndex { get; }
Integer
Sets whether the GridItem will be visible or with style="display:none;"
public virtual bool Display { get; set; }
Sets the Item in edit mode. Requires Telerik RadGrid to rebind.
Gets or sets a value indicating whether the grid item is expanded or collapsed.
public virtual bool Expanded { get; set; }
Gets the index of the Item in the group. This works only when grouping.
public string GroupIndex { get; }
Returns a string formed: X_Y_Z, where:
- X is a zero-based value representing the group index (the first group of results
will have index = 0)
- Y is a zero-based value representing the group level. If you group the grid using 2 criteria, the inner groups will have index = 1.
- Z is a zero-based value representing the GridItem index in the group (the first item will have index = 0)
Note that if you use more criteria, you will have more indexes returned: X_Y_Z_W, where the last one is always the item index in the group.
Gets a value indicating whether this item has child items - or items somehow related to this.
public virtual bool HasChildItems { get; }
Gets a value indicating whether the grid item is bound to a data source.
public virtual bool IsDataBound { get; }
Gets a value indicating whether the grid item is in edit mode at the moment.
public virtual bool IsInEditMode { get; }
Gets the index of the grid item among the Items collection. This index also can be used to get the DataKeyValues corresponding to this item from a GridTableView.
public virtual int ItemIndex { get; }
Get the unique item index among all the item in the hierarchy. This index is used when setting item to selected, edited, etc
public string ItemIndexHierarchical { get; }
Gets the respective GridItemType of the grid item.
public virtual GridItemType ItemType { get; }
Gets the ClientID of the RadGrid instance that owns the item.
[Browsable(false)]
public virtual string OwnerGridID { get; }
This would be useful if several controls use the same eventhandler and you need to diferentiate the Grid instances in the handler.
Gets the ClientID of the GridTableView that owns this instance.
[Browsable(false)]
public virtual string OwnerID { get; }
Gets a reference to the GridTableView that owns this GridItem.
public GridTableView OwnerTableView { get; }
Methods
protected override void AddAttributesToRender(HtmlTextWriter writer)
Overrides:
Calculate column-span value for a cell using column list, when the cell indicated with FromCellIndex should be spanned to ToCellIndex
protected int CalcColSpan(GridColumn[] columns, int FromCellIndex, int ToCellIndex)
columns - visible property is taken in count
FromCellIndexintcell inbdex of spanned cell
ToCellIndexintcell index of next not-spanned cell or -1 for the last cell index
Returns:ColSpan number
public void ExpandHierarchyToTop()
Use this method to simulate item command event that bubbles to RadGrid and can be handeled automatically or in a custom manner, handling RadGrid.ItemCommand event.
protected virtual void OnCellDataBound(GridColumn column, TableCell cell)
protected virtual void OnCollapse()
protected virtual void OnExpand()
protected virtual void RemoveEditedChildren()