GridTableView
Represents one table of data.
In case of flat grid structure, i.e. no hierarchy levels, this object is the MasterTableView itself.
In case of hierarchical structure, the topmost GridTableView is the MasterTableView. All inner (child) tables are refered as DetailTables. Each table that has children tables has a collection called DetailTables where you can access these tables.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
public class GridTableView : GridTableViewBase, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, INamingContainer
Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlCompositeDataBoundControlGridTableViewBaseGridTableView...
Implements:
Inherited Members
Constructors
Default contructor for GridTableView - generally used by Page serializer only.
public GridTableView()
Constructs a new GridTableView and sets as its owner the RadGrid object. Sets the IsTrackingViewState property to the corresponding value of the boolean parameter.
Constructs a new GridTableView and sets as its owner the RadGrid object.
Properties
Gets or sets values indicating DataFieldNames that should be sorted, grouped, etc and are not included as columns, in case the property RetrieveAllDataFields is false.
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[TypeConverter(typeof(GridStringArrayConverter))]
public virtual string[] AdditionalDataFieldNames { get; set; }
An array of DataFieldNames values that should be sorted, grouped, etc and are not included as columns.
Gets or sets a value indicating whether Telerik RadGrid will perform automatic deletes, i.e. using the DataSource controls functionality.
public bool AllowAutomaticDeletes { get; set; }
true, if Telerik RadGrid will perform automatic deletes; otherwise, false. The default value is false.
Gets or sets a value indicating whether Telerik RadGrid will perform automatic inserts, i.e. using the DataSource controls functionality.
public bool AllowAutomaticInserts { get; set; }
true, if the Telerik RadGrid will perform automatic inserts; otherwise, false. The default value is false.
Gets or sets a value indicating whether Telerik RadGrid will perform automatic updates, i.e. using the DataSource controls functionality.
public bool AllowAutomaticUpdates { get; set; }
true, if Telerik RadGrid will perform automatic updates; otherwise, false. The default value is false.
Gets or sets if the custom paging feature is enabled.
public virtual bool AllowCustomPaging { get; set; }
true, if the custom paging feature is enabled; otherwise, false. Default value is the value of AllowCustomPaging.
There are cases in which you may want to fetch only a fixed number of records and perform operations over this specified set of data. Telerik RadGrid allows such data manipulation through the custom paging mechanism integrated in the control. The main steps you need to undertake are:
- Set AllowPaging = true and AllowCustomPaging = true for your grid instance
- Implement code logic which to extract merely a fixed number of records from the grid source and present them in the grid structure
- The total number of records in the grid source should be defined through the VirtualItemCount property of the MasterTableView/GridTableView instance. 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.
Gets or sets if the custom sorting feature is enabled.
public virtual bool AllowCustomSorting { get; set; }
true, if custom sorting feature is enabled; otherwise, false. The default value is false.
With custom sorting turned on, RadGrid will display as Sorting Icons, will maintain the SortExpressions collection and so on, but it will not actually sort the Data. You should perform the custom sorting in the SortCommand event handler. You can also use the GetSortString() method, which will return the sort expressions string in the same format as it wold be used by a DataView component.
Gets or sets a value indicating whether the filtering by column feature is enabled.
public virtual bool AllowFilteringByColumn { get; set; }
true if the filtering by column feature is enabled; otherwise, false. Default value is the value of AllowFilteringByColumn.
When the value is true, GridTableView will display the filtering item, under the table's header item. The filtering can be controlled based on a column through column properties: FilterListOptions , CurrentFilterFunction, CurrentFilterValue. The column SupportsFiltering() method is used to determine if a column can be used with filtering. Generally, this function returns the value set to AllowFiltering for a specific column.
Gets or sets the value indicating wheather more than one column can be sorted in a single GridTableView. The order is the same as the sequence of expressions in SortExpressions.
public bool AllowMultiColumnSorting { get; set; }
true, if more than one column can be sorted in a single GridTableView; otherwise, false. The default value is false.
Gets or sets the value indicated whether the no-sort state when changing sort order will be allowed.
public bool AllowNaturalSort { get; set; }
true, if the no-sort state when changing sort order will be allowed; otherwise, false. The default value is true.
Gets or sets a value indicating whether the paging feature is enabled.
public virtual bool AllowPaging { get; set; }
true if the paging feature is enabled; otherwise, false. The default is AllowPaging.
Instead of displaying all the records in the data source at the same time, the GridTableView control can automatically break the records up into pages. If the data source supports the paging capability, the GridTableView 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 GridTableView 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 row called the pager item is automatically displayed in the GridTableView control. The pager row contains controls that allow the user to navigate to the other pages. You can control the settings of the pager row (such as the pager display mode, the number of page links to display at a time, and the pager control's text labels) by using the PagerStyle properties. The pager row 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 six built-in pager display modes by setting the Mode property.
The GridTableView control also allows you to define a custom template for the pager row. For more information on creating a custom pager row template, see PagerTemplate.
The GridTableView control provides an event that you can use to perform a custom action when paging occurs.
Event Description PageIndexChanged Occurs when one of the pager buttons is clicked, but after the GridTableView control handles the paging operation. This event is commonly used when you need to perform a task after the user navigates to a different page in the control.
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 AllowSorting.
When a data source control that supports sorting is bound to the GridTableView control, the GridTableView 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 SortExpressions property set is displayed as a link button.
Clicking the link button for a column causes the items in the GridTableView 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 GridTableView 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 GridTableView control is applying by using the SortExpressions property. Clicking a column's link button repeatedly toggles the sort direction between ascending and descending order.
Note that if you want to sort the grid by a column different than a GridBoundColumn, you should set also its SortExpression property to the desired data field name you want the column to be sorted by.
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of alternating items in a GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle AlternatingItemStyle { get; }
A reference to the GridTableItemStyle that represents the style of alternating data items in a GridTableView control. If style is not altered (is default) AlternatingItemStyle is used.
Use the AlternatingItemStyle property to control the appearance of alternating items in a GridTableView control. When this property is set, the 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 GridTableView 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 GridTableView 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 Telerik RadGrid will automatically generate columns at runtime based on its DataSource.
public virtual bool AutoGenerateColumns { get; set; }
A value indicating whether Telerik RadGrid will automatically generate columns at runtime based on its DataSource. The default value is the value of RadGrid's property AutoGenerateColumns.
Get an array of automatically generated columns. This array is available when AutoGenerateColumns is set to true. Autogenerated columns appear always after Columns when rendering.
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[Browsable(false)]
public GridColumn[] AutoGeneratedColumns { get; }
An array of automatically generated columns.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridBatchEditingSettings BatchEditingSettings { get; }
Gets or sets a value indicating whether Telerik RadGrid should retrieve all data and ignore server paging in case of filtering or grouping.
public virtual bool CanRetrieveAllData { get; set; }
true (default) if the retrieve all data feature is enabled; otherwise, false.
Gets or sets a string that specifies a brief description of a GridTableView. Related to Telerik RadGrid accessibility compliance.
public virtual string Caption { get; set; }
A string that represents the text to render in an HTML caption element in a GridTableView control. The default value is an empty string ("").
Use the Caption property to specify the text to render in an HTML caption element in a GridTableView control. The text that you specify provides assistive technology devices with a description of the table that can be used to make the control more accessible.
Get or set Path for the WebService that to be used for populating filter checklist with values.
public virtual string CheckListWebServicePath { get; set; }
Gets all items among the hierarchy of GridTableView items that are in edit mode. The edit items in a GridTableView are cleared when ParentItem collapses.
[Browsable(false)]
public GridItemCollection ChildEditItems { get; }
A GridItemCollection of items that are in edit mode.
Gets all items among the hierarchy of GridTableView items that are selected. The selected items in a GridTableView are cleared when ParentItem collapses and the ParentItem becomes selected.
[Browsable(false)]
public GridItemCollection ChildSelectedItems { get; }
A GridItemCollection of items among the hierarchy of GridTableView items that are selected.
This property is used to specify the field from the underlying datasource,
which will populate the ClientDataKeyNames collection.
This collection can later be accessed on the client, to get the key
value(s).
The following example demonstrates the extraction of the data key value for a given data table view object:
<ClientSettings>
<ClientEvents OnHierarchyExpanded="HierarchyExpanded" />
</ClientSettings>
<script type="text/javascript">
function HierarchyExpanded(sender, args)
{
var firstClientDataKeyName =
args.get_tableView().get_clientDataKeyNames()[0];
alert("Item with " + firstClientDataKeyName + ":'" +
args.getDataKeyValue(firstClientDataKeyName)
+ "' expanded.");
}
</script>
The logic is placed in the OnHierarchyExpanded client side event handler,
which is triggered when the user expands a node
in a hierarchical grid, but can be used in any other event, given that a proper
reference to the client table view object is obtained.
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[TypeConverter(typeof(GridStringArrayConverter))]
public virtual string[] ClientDataKeyNames { get; set; }
Gets the server control identifier generated by ASP.NET.
public override string ClientID { get; }
The server control identifier generated by ASP.NET.
Overrides:
Gets the column groups.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridColumnGroupCollection ColumnGroups { get; }
Returns the column groups in a collection of type GridColumnGroupCollection.
Gets a collection of GridColumn objects that represent the column fields in a GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridColumnCollection Columns { get; }
A GridColumnCollection that contains all the column fields in the GridTableView control.
A column field represents a column in a GridTableView control. The Columns property (collection) is used to store all the explicitly declared column fields that get rendered in the GridTableView control. You can also use the Columns collection to programmatically manage the collection of column fields.
The column fields are displayed in the GridTableView control in the order that the column fields appear in the Columns collection.
To get a list of all columns rendered in the current instance use RenderColumns
Although you can programmatically add column fields to the Columns collection, it is easier to list the column fields declaratively in the GridTableView control and then use the Visible property of each column field to show or hide each column field.
If the Visible property of a column field is set to false, the column is not displayed in the GridTableView control and the data for the column does not make a round trip to the client. If you want the data for a column that is not visible to make a round trip, add the field name to the DataKeyNames property.
This property can be managed programmatically or by Property Builder (IDE designer).
public List<GridTableView.PersistableColumnSetting> ColumnSettings { get; set; }
Gets or sets the default position of the GridCommandItem as defined by the GridCommandItemDisplay. The possible values are:
- None - this is the default value - the command item will not be rendered
- Top - the command item will be rendered on the top of the grid
- Bottom - the command item will be rendered on the bottom of the grid
- TopAndBottom - the command item will be rendered both on top and bottom of the grid.
public GridCommandItemDisplay CommandItemDisplay { get; set; }
A GridCommandItemDisplay proprty which define the default position of the GridCommandItem.
Gets a set the options for GridTableView's command item.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridCommandItemSettings CommandItemSettings { get; }
The options for GridTableView's command item.
Gets a referenct to the GridTableItemStyle object that allows you to set the appearance of the command item in a GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridTableItemStyle CommandItemStyle { get; }
A reference to the GridTableItemStyle that represents the style of the command item.
Gets or sets the template that will be instantiated in the CommandItem. If this template is set, RadGrid will not create the default CommandItem controls.
[TemplateContainer(typeof(GridItem))]
[Bindable(false)]
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate CommandItemTemplate { get; set; }
A System.Web.UI.ITemplate object that contains the custom content for the pager item. The default value is null, which indicates that this property is not set.
Gets or sets a value indicating the index of the currently active page in case paging is enabled (AllowPaging is true).
[Bindable(true)]
[Browsable(false)]
public int CurrentPageIndex { get; set; }
The index of the currently active page in case paging is enabled.
Gets or sets a value that describes how RadGrid would respond if the CurrentPageIndex is invalid when data-binding.
public GridResetPageIndexAction CurrentResetPageIndexAction { get; set; }
A member of the GridResetPageIndexAction enumeration which describes how RadGrid would respond if the CurrentPageIndex is invalid when data-binding. By default its value is SetPageIndexToFirst
This property is not persisted in the ViewState. By deafult the value is SetPageIndexToFirst.
Gets or sets an array of data-field names that will be used to populate the DataKeyValues collection, when the GridTableView control is databinding.
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[TypeConverter(typeof(GridStringArrayConverter))]
public virtual string[] DataKeyNames { get; set; }
An array that contains the names of the primary key fields for the items displayed in a GridTableView control.
Use the DataKeyNames property to specify the field or fields that represent the primary key of the data source.
Note: Values set to this property are case-sensitive! The field names should be coma-separated.
The data key names/values are stored in the ViewState so they are available at any moment after grid have been data-bound, after postbacks, etc. This collection is used when editing data, and for automatic relations when binding an hiararchical grid (see ParentTableRelation).
If the Visible property of a column field is set to false, the column is not displayed in the GridTableView control and the data for the column does not make a round trip to the client. If you want the data for a column that is not visible to make a round trip, add the field name to the DataKeyNames property.
Gets a collection of DataKeyValue objects that represent the data key value of the corresponding item (specified with its ItemIndex) and the DataKeyName (case-sensitive!). The DataKeyName should be one of the specified in the DataKeyNames array.
[Browsable(false)]
public virtual GridDataKeyArray DataKeyValues { get; }
data key name/value pair
When the DataKeyNames property is set, the GridTableView control automatically creates a DataKeyValue object for each item in the control. The DataKeyValue object contains the values of the field or fields specified in the DataKeyNames property. The DataKeyValue objects are then added to the control's DataKeysValue collection. Use the DataKeysValue property to retrieve the DataKeyValue object for a specific data item in the GridTableView control.
Gets or sets the object from which the data-bound control retrieves its list of data items.
[Browsable(false)]
public override object DataSource { get; set; }
An object that represents the data source from which the GridTableView control retrieves its data. The default is a null reference (Nothing in Visual Basic).
Overrides:
Generally the DataSource object references DataSource. Assign this property only if you need to change the default behavior or RadGrid.
RadGrid modifies this property when DataSource is assigned.
On postback the DataSource property settings are not persisted due to performance reasons. Note, however, that you can save the grid DataSource in a Session/Application/Cache variable and then retrieve it from there after postback invocation. Respectively, you can get the changes made in the data source in a dataset object and then operate with them.
This property cannot be set by themes or style sheet themes.
Gets the number of pages if paging is enabled.
[Browsable(false)]
public int DataSourceCount { get; }
The number of pages if paging is enabled.
Gets or sets the ID of the DataSource control used for population of this GridTableView data items.
public override string DataSourceID { get; set; }
The ID of a control that represents the data source from which the data-bound control retrieves its data. The default is String.Empty ("").
Overrides:
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; }
DetailwItemTemplate is a template that will be instantiated as a part of each data item. Supports one-way databinding.
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(GridDetailTemplateItem), BindingDirection.OneWay)]
public virtual ITemplate DetailItemTemplate { get; set; }
Gets or sets the collection of detail table views for this GridTableView
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridTableViewCollection DetailTables { get; }
A collection of detail table views for this GridTableView.
Adding or removing objects to the DetailTables collection changes the hierarchical structure.
Use Rebind() after modifying the collection programmatically.
This collection can also be altered unsing the environment designer.
Gets or sets the text direction. This property is related to Telerik RadGrid support for Right-To-Left lanugages. It has two possible vales defined by GridTableTextDirection enumeration:
- LTR - left-to-right text
- RTL - right-to-left text
public virtual GridTableTextDirection Dir { get; set; }
Gets a value defining the setting that will be applied when an Item is in edit mode and the EditMode property is set to EditForms.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridEditFormSettings EditFormSettings { get; }
Gets a reference to the >GridTableItemStyle object that allows you to set the appearance of the item selected for editing in a GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridTableItemStyle EditItemStyle { get; }
A reference to the GridTableItemStyle that represents the style of the row being edited in a GridTableView control. If style is not altered (is default) EditItemStyle is used.
Use the EditItemStyle property to control the appearance of the item in edit mode. 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 GridTableView control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, EditItemStyle-ForeColor).
- Nest an <EditItemStyle> element between the opening and closing tags of the GridTableView 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.
Gets or sets the EditItemTemplate, which is rendered in the control in edit mode.
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(GridItem), BindingDirection.TwoWay)]
public virtual ITemplate EditItemTemplate { get; set; }
A value of type System.Web.UI.CompiledBindableTemplateBuilder
FormsGets or sets a value indicating how a GridItem will look in edit mode.
public GridEditMode EditMode { get; set; }
A value indicating how a GridItem will look in edit mode. The default is EditForms.
There are two possible values defined by the GridEditMode enumeration:
- InPlace
- EditForms
To display the grid column editors inline when switching grid item in edit mode (see the screenshot below), you simply need to change the EditMode property to InPlace.
<pre> <pre><code class="lang-csharp"><radg:RadGrid id="RadGrid1" runat="server"><MasterTableView AutoGenerateColumns="True" EditMode="InPlace" /></radg:RadGrid></code></pre>
To display the grid column editors in auto-generated form when switching grid item in edit mode (see the screenshot below), you simply need to change the MasterTableView EditMode property to EditForms.
<pre> <pre><code class="lang-csharp"><radg:RadGrid id="RadGrid1" runat="server"><MasterTableView AutoGenerateColumns="True" EditMode="EditForms" /></radg:RadGrid></code></pre>![]()
Gets or sets a value indicating whether all columns settings will be persisted in the ViewState or not.
public virtual bool EnableColumnsViewState { get; set; }
true if columns are kept in the view state; otherwise false. The default value is true.
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 value is the value of EnableHeaderContextFilterMenu.
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 value is the value of EnableHeaderContextMenu.
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 grouping will use LINQ queries.
public virtual bool EnableLinqGrouping { get; set; }
A value indicating whether grouping will use LINQ queries.
Gets or sets a value indicating whether RadGrid will show NoRecordsTemplate instead of the corresponding GridTableView if there is no items to display.
public bool EnableNoRecordsTemplate { get; set; }
true if NoRecordsTemplate usage is enabled; otherwise, false. The default value is true.
Gets or sets a value indicating if the text in the header of the GridTableView should be split on capital letter.
public bool EnableSplitHeaderText { get; set; }
Gets a reference to the ExpandCollapseColumn object, allowing you to customize its settings.
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridExpandColumn ExpandCollapseColumn { get; set; }
The property setter does nothing and should not be used. It works around a bug in the VS.NET designer.
Gets or sets the filtering options for grid columns.
public string FilterExpression { get; set; }
In the most common case, Telerik RadGrid checks all filtering options for each column, then prepares a filter expression and sets this property internally.
Note: You should be careful when setting this property as it may break the whole filtering functionality for your grid.
More info on the way, the expressions are created you can find here (external link to MSDN library).
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the filter item in a GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridTableItemStyle FilterItemStyle { get; }
A reference to the GridTableItemStyle that represents the style of the filter item.
Manage visual style of the footer item.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridTableItemStyle FooterStyle { get; }
A reference to the GridTableItemStyle that represents the style of the footer item. If style is not altered (is default) FooterStyle is used.
Gets or sets a value specifying the frame table attribute.
public virtual GridTableFrame Frame { get; set; }
A GridTableFrame value, specifying the frame table attribute.
The frame attribute for a table specifies which sides of the frame surrounding the table will be visible. Possible values:
- void: No sides. This is the default value.
- above: The top side only.
- below: The bottom side only.
- hsides: The top and bottom sides only.
- vsides: The right and left sides only.
- lhs: The left-hand side only.
- rhs: The right-hand side only.
- box: All four sides.
- border: All four sides
Gets or sets a value indicating whether the border lines for grid cells will be displayed.
public override GridLines GridLines { get; set; }
One of the GridLines values. The default is Both.
Overrides:
Use the GridLines property to specify the gridline style for a GridTableView control. The following table lists the available styles.
Style Description GridLines.None No gridlines are displayed. GridLines.Horizontal Displays the horizontal gridlines only. GridLines.Vertical Displays the vertical gridlines only. GridLines.Both Displays both the horizontal and vertical gridlines.
Adding GridGroupByExpression to this collection will cause the current table-view to display items sorted and devided in groups separated by GridGroupHeaderItems, that display common group and aggregate field values. See Expression on details of expressions syntax.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridGroupByExpressionCollection GroupByExpressions { get; }
A GroupByExpressionCollection of values that will cause the current table-view to display items sorted and devided in groups separated by GridGroupHeaderItems, that display common group and aggregate field values.
Note that the correctness of the expressions in the collection is checked when DataBind occures. Then if an expression in not correct or a combination of expressions is erroneous a GridGroupByException would be thrown on DataBind(). This property's value is preserved in the ViewState.
Gets or sets the group footer ItemTemplate.
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(GridItem), BindingDirection.OneWay)]
public virtual ITemplate GroupFooterTemplate { get; set; }
Manage visual style of the group header items.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle GroupHeaderItemStyle { get; }
A reference to the GridTableItemStyle that represents the style of the group header items. If style is not altered (is default) GroupHeaderItemStyle is used.
Gets or sets the group header ItemTemplate.
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(GridItem), BindingDirection.OneWay)]
public virtual ITemplate GroupHeaderTemplate { get; set; }
Specifies where the grouping will be handled. There are two options:
- Server-side - GridTableView.GroupLoadMode.Server
- Client-side - GridTableView.GroupLoadMode.Client
public GridGroupLoadMode GroupLoadMode { get; set; }
GridTableView.GroupLoadMode.Server
This is the default behavior. Groups are expanded after postback to the server for example:
<pre> <pre><code class="lang-csharp"><MasterTableView GroupLoadMode="Server"></code></pre>GridTableView.GroupLoadMode.ClientGroups will be expanded client-side and no postback will be performed.
and set the client setting AllowGroupExpandCollapse to true:
<pre> <pre><code class="lang-csharp"><MasterTableView GroupLoadMode="Client"></code></pre>
<pre> <pre><code class="lang-csharp"><ClientSettings AllowGroupExpandCollapse="True"></code></pre>
Gets or sets a value indicating whether the groups will be expanded on grid load (true by default).
public bool GroupsDefaultExpanded { get; set; }
true, if the groups will be expanded on grid load; otherwise, false. The default value is true.
Gets a value indicating if the GridTableView instance has children (Detail) tables.
[Browsable(false)]
public bool HasDetailTables { get; }
true, if the GridTableView instance has children (Detail) tables; otherwise, false.
Gets value indicating whether the GridTableView will render multiple headers. Read only.
public bool HasMultiHeaders { get; }
True if the table view has multiple headers, otherwise false.
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of the header item in a GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridTableItemStyle HeaderStyle { get; }
A reference to the GridTableItemStyle that represents the style of the header row in a GridTableView control. If style is not altered (is default) HeaderStyle is used.
Use the HeaderStyle property to control the appearance of the header item in a GridTableView 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 GridTableView control in the form Property-Subproperty, where Subproperty is a property of the GridTableItemStyle object (for example, HeaderStyle-ForeColor).
- Nest a <HeaderStyle> element between the opening and closing tags of the GridTableView control.
The properties can also be set programmatically in the form Property.Subproperty (for example, HeaderStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.
Gets or sets a value indicating whether the hierarchy will be expanded by default. The default value of the property is false.
public bool HierarchyDefaultExpanded { get; set; }
The unique hierarchy index of the current table view, generated when it is binding.
[Browsable(false)]
public string HierarchyIndex { get; }
The hierarchy index of the current table view.
Gets or sets a value indicating when the DataBind of the child GridTableView will occur when working in hierarchy mode. Accepts values from GridChildLoadMode enumeration. See the remars for details.
public GridChildLoadMode HierarchyLoadMode { get; set; }
The default value is ServerOnDemand.
Changing this propery value impacts the performance the following way:
- In ServerBind mode - Roundtrip to the database only when grid is bound. ViewState holds all detail tables data. Only detail table-views of the expanded items are rendered. Postback to the server to expand an item
- In ServerOnDemand mode - Roundtrip to the database when grid is bound and when item is expanded. ViewState holds data for only visible Items (smallest possible). Only detail table-views of the expanded items are rendered. Postback to the server to expand an item.
- In Client mode - Roundtrip to the database only when grid is bound. ViewState holds all detail tables data. All items are rendered - even is not visible (not expanded). NO postback to the server to expand an item - expand/collapse of hierarchy items is managed client-side.
Note: In order to use client-side hierarchy expand, you will need to set also AllowExpandCollapse to true.
Gets or sets a value indicating the horizontal alignment of the grid table.
public override HorizontalAlign HorizontalAlign { get; set; }
One of the HorizontalAlign values. The default is NotSet.
Overrides:
Use the HorizontalAlign property to specify the horizontal alignment of a GridTableView control within the page. The following table lists the different horizontal alignment styles.
Alignment value Description HorizontalAlign.NotSet The horizontal alignment of the GridTableView control has not been set. HorizontalAlign.Left The GridTableView control is left-aligned on the page. HorizontalAlign.Center The GridTableView control is centered on the page. HorizontalAlign.Right The GridTableView control is right-aligned on the page. HorizontalAlign.Justify The GridTableView control is aligned with both the left and right margins of the page.
Gets or sets the programmatic identifier assigned to the current GridTableView.
[Browsable(false)]
public override string ID { get; set; }
The programmatic identifier assigned to the control.
Overrides:
This property is set automatically by RadGrid object that owns this instance.
Gets or sets a value determining the position of the GridEditFormInsertItem.
public GridInsertItemDisplay InsertItemDisplay { get; set; }
A value determining the position of the GridEditFormInsertItem.
Gets or sets on which page the GridTableView will go after item insertion.
public GridInsertItemPageIndexAction InsertItemPageIndexAction { get; set; }
Gets or sets the name of the method to call in order to insert data
public string InsertMethod { get; set; }
Gets or sets the Expanded value of the GridFilteringItem.
public bool IsFilterItemExpanded { get; set; }
The Expanded value of the GridFilteringItem.
Gets or sets a value indicating if the GridTableView is currently in insert mode.
[Browsable(false)]
public bool IsItemInserted { get; set; }
true, if the GridTableView is currently in insert mode; otherwise, false.
The ItemInserted property indicates if the GridTableView is currently in insert mode. After setting it you should call the Rebind() method. You can also use the InsertItem() method, that will also reposition the grid to show the last page, where the newly inserted item is generally displayed.
Gets a collection of GridDataItem objects that represent the data items in a GridDataItem control.
[Browsable(false)]
public virtual GridDataItemCollection Items { get; }
A GridDataItemCollection that contains all the data items in a GridTableView control
The Items property (collection) is used to store the data items in a GridTableView control. The GridTableView 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.
Indicates whether the items have been created, generally by data-binding.
[Browsable(false)]
public bool ItemsCreated { get; }
true, if the items have beed created; otherwise, false.
Gets a collection of all data items of a grid table view and items that belong
to child tables of the GridTableView if the hierarchy is
expanded. The items are collected depth-first. The property
Items actually referres to
ItemsHierarchy of
MasterTableView. This property can be used to
traverse all
DataItems items in the hiearchy of a GridTableView.
[Browsable(false)]
public virtual GridDataItemCollection ItemsHierarchy { get; }
A GridDataItemCollection of all data items of a grid table view and items that belong to child tables of the GridTableView if the hierarchy is expanded.
Gets a reference to the GridTableItemStyle object that allows you to set the appearance of items in a GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual GridTableItemStyle ItemStyle { get; }
A reference to the GridTableItemStyle that represents the style of data items in a GridTableView control. If style is not altered (is default) ItemStyle is used.
Gets or sets the ItemTemplate, which is rendered in the control in normal (non-Edit) mode.
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(GridItem), BindingDirection.TwoWay)]
public virtual ITemplate ItemTemplate { get; set; }
A value of type System.Web.UI.CompiledBindableTemplateBuilder
Gets a referenct to the GridTableItemStyle object that allows you to set the appearance of the multi header item in a >GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridTableItemStyle MultiHeaderItemStyle { get; }
A reference to the GridTableItemStyle that represents the style of the multi header item.
Gets or sets the name of the GridTableView.
public virtual string Name { get; set; }
The string representation of the Name of the GridTableView it is assigned to. The default is String.Empty ("").
The Name property can be used distinguish different GridTableView instances. Often used to set different settings for different views conditionally.
Gets a set of options for the GridTableView's data-bound nested view template.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridNestedViewSettings NestedViewSettings { get; }
Gets or sets the ItemTemplate, which is rendered in the control in normal (non-Edit) mode.
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateContainer(typeof(GridItem), BindingDirection.TwoWay)]
public virtual ITemplate NestedViewTemplate { get; set; }
A value of type System.Web.UI.CompiledBindableTemplateBuilder
Gets or sets the text that will be displayed in there is no NoRecordsTemplate defined and no records in the Detail tables.
public string NoDetailRecordsText { get; set; }
The text to display in the empty data item. The default is an empty string (""), which indicates that this property is not set.
The empty data row is displayed in a GridTableView control when the data source that is bound to the control does not contain any records. Use the NoMasterRecordsText and NoDetailRecordsText property to specify the text to display in the empty data item. Alternatively, you can define your own custom user interface (UI) for the empty data item by setting the NoRecordsTemplate property instead of this property.
Gets or sets the text that will be displayed in there is no NoRecordsTemplate defined and no records in the MasterTableView.
public string NoMasterRecordsText { get; set; }
The text to display in the empty data item. The default is an empty string ("") which indicates that this property is not set.
The empty data row is displayed in a GridTableView control when the data source that is bound to the control does not contain any records. Use the NoMasterRecordsText and NoDetailRecordsText property to specify the text to display in the empty data item. Alternatively, you can define your own custom user interface (UI) for the empty data item by setting the NoRecordsTemplate property instead of this property.
Gets or sets the template that will be displayed if a GridTableView control is bound to a data source that does not contain any records.
[TemplateContainer(typeof(GridTableView))]
[Browsable(false)]
[Bindable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate NoRecordsTemplate { get; set; }
A System.Web.UI.ITemplate that contains the custom content for the empty data row. The default value is a null reference (Nothing in Visual Basic), which indicates that this property is not set.
You can set the text that will appear in the NoRecordsTemplate through NoMasterRecordsText and NoDetailRecordsText properties.
By default if Items.Count equals 0, GridTableView will render no records message.
If NoRecordsTemplate and NoMasterRecordsText/NoDetailRecordsText are set, the NoRecordsTemplate property has priority.
Gets or sets a value indicating if the GridTableView should override the default DataSourceControl sorting with grid native sorting.
public bool OverrideDataSourceControlSorting { get; set; }
You can set this to true in case of ObjectDataSource with IEnumerable data without implemented sorting.
Gets the ClientID of the RadGrid object that contains this instance.
[Browsable(false)]
public virtual string OwnerID { get; }
The string representation of the ClientID object that contains the instance.
Gets the number of pages required to display the records of the data source in a GridTableView control.
[Browsable(false)]
public int PageCount { get; }
The number of pages in a GridTableView 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 pager item in a GridTableView control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridPagerStyle PagerStyle { get; }
A reference to the GridPagerStyle that represents the style of the pager item in a GridTableView control. If style is not altered (is default) PagerStyle is used.
Use the PagerStyle property to control the appearance of the pager item in a GridTableView control. The pager item is displayed when the paging feature is enabled (by setting the AllowPaging property to true) and contains the controls that allow the user to navigate to the different pages in the control. This property is read-only; however, you can set the properties of the GridPagerStyle object it returns. The properties can be set declaratively using one of the following methods:
- Place an attribute in the opening tag of the GridTableView control in the form Property-Subproperty, where Subproperty is a property of the GridPagerStyle object (for example, PagerStyle-ForeColor).
- Nest a <PagerStyle> element between the opening and closing tags of the GridTableView control.
The properties can also be set programmatically in the form Property.Subproperty (for example, PagerStyle.ForeColor). Common settings usually include a custom background color, foreground color, and font properties.
Gets or sets the custom content for the pager item in a GridTableView control.
[TemplateContainer(typeof(GridItem))]
[Browsable(false)]
[Bindable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate PagerTemplate { get; set; }
A System.Web.UI.ITemplate that contains the custom content for the pager item. The default value is null, which indicates that this property is not set.
If this template is set, RadGrid will not create the default pager controls.
Specify the maximum number of items that would appear in a page, when paging is enabled by AllowPaging or AllowCustomPaging property. Default value is the value of PageSize.
public virtual int PageSize { get; set; }
The number of records to display on a single page. The default is 10.
Exceptions: ArgumentOutOfRangeExceptionThe PageSize property is set to a value less than 1.
When the paging feature is enabled (by setting the AllowPaging property to true), use the PageSize property to specify the number of records to display on a single page.
Gets a Paging object that is the result of paging settings and runtime paging state of the grid.
[Browsable(false)]
public GridPagingManager PagingManager { get; }
A >GridPagingManager object that corresponds to the Paging object.
Note that changes made to this object would not have effect on the structure of the grid.
Gets a reference to a GridItem that is a parent of this GridTableView, when this GridTableView represents a child table in a hierarchical structure.
[Browsable(false)]
public GridDataItem ParentItem { get; }
A reference to the server control's parent control.
Whenever a page is requested, a hierarchy of server controls on that page is built. This property allows you to determine the parent control of the current server control in that hierarchy, and to program against it.
Gets or sets the collection of data-field pairs that describe the relations in a hierarchical grid.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridTableViewRelation ParentTableRelation { get; }
A GridTableViewRelation collection of data-field pairs that describe the relations in a hierarchical grid.
If you have specified the relations RadGrid will automatically filter the child data-source when when binding detail-tables. The specified MasterKeyField in each GridRelationFields in this collection should be a Key that is specified in the parent table's DataKeyNames array. Each DetailKeyField specfied should also be included in this GridTableView's DataKeyNames array. MasterTableView does not need any ParentTableRelations.
Gets or sets a value indicating whether white-space characters inside the filter expression will be trimmed.
public virtual bool PersistWhiteSpacesInFilter { get; set; }
When the value is true, it will not be trimmed and any white-space characters in it will be included in the filter expression.
Gets the rendering style of an ActiveItem.
[Browsable(false)]
public GridTableItemStyle RenderActiveItemStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of an ActiveItem.
Gets the rendering style of the AlternatingItem.
[Browsable(false)]
public GridTableItemStyle RenderAlternatingItemStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of the AlternatingItem. If AlternatingItemStyle is not specified the return value is OwnerGrid.AlternatingItemStyle.
Gets an array of all columns that are used when rendering the grid instance.
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[Browsable(false)]
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
public GridColumn[] RenderColumns { get; }
An array of all columns that are used when rendering the grid instance.
Modifying the array would not affect rendering as it is regenerated before each data-bind. To modify the list of columns available use Columns property.
Gets the rendering style of a CommandItem.
[Browsable(false)]
public GridTableItemStyle RenderCommandItemStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of a CommandItem. If CommandItemStyle is not specified the return value is OwnerGrid.CommandItemStyle.
Gets the rendering style of an edit Item.
[Browsable(false)]
public GridTableItemStyle RenderEditItemStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of an edit item. If EditItemStyle is not specified the return value is OwnerGrid.EditItemStyle.
Gets the rendering style of a FilterItem.
[Browsable(false)]
public GridTableItemStyle RenderFilterItemStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of a FilterItem. If FilterItemStyle is not specified the return value is OwnerGrid.FilterItemStyle
Gets the rendering style of an FooterItem.
[Browsable(false)]
public GridTableItemStyle RenderFooterStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of an FooterItem. If FooterStyle is not specified the return value is OwnerGrid.FooterStyle.
Gets the rendering style of the group header items.
[Browsable(false)]
public GridTableItemStyle RenderGroupHeaderItemStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of the group header items. If GroupHeaderItemStyle is not specified the return value is OwnerGrid.GroupHeaderItemStyle.
Gets the rendering style of a GridHeaderItem.
[Browsable(false)]
public GridTableItemStyle RenderHeaderStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of the GridHeaderItem. If HeaderStyle is not specified the return value is OwnerGrid.HeaderStyle.
Gets the rendering style of a MultiHeaderItem.
[Browsable(false)]
public GridTableItemStyle RenderMultiHeaderItemStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of a MultiHeaderItem. If MultiHeaderItemStyle is not specified the return value is OwnerGrid.MultiHeaderItemStyle.
Gets the rendering style of the Pager item.
[Browsable(false)]
public GridPagerStyle RenderPagerStyle { get; }
A reference to the GridTableItemStyle that represents the rendering style of the pager item. If PagerStyle is not specified the return value is OwnerGrid.PagerStyle.
Gets or sets a value indicating whether RadGrid will be built on PreRender unless it was built before that. This property is supposed for Telerik RadGrid internal usage, yet you can set it with care.
[Browsable(false)]
public bool RequiresBinding { get; set; }
true, if the RadGrid will be built on PreRender; otherwise, false.
Gets a DataView object that represents the data sent to the GridTableView to be displayed.
[Browsable(false)]
public DataView ResolvedDataSourceView { get; }
A result DataView object of all grid operations.
ResolvedDataSourceView is available only in ItemDataBound event handler i.e. when the grid is bound.
Gets or sets a value indicating whether the GridTableView will extract all bindable properties from the DataSource when binding, to perform operations like sorting, grouping, etc on DataFields that are not included in the column declarations.
public bool RetrieveAllDataFields { get; set; }
true, if the GridTableView will extract all bindable properties from the DataSource when binding; otherwise, false. The default value is true.
You can also use the AdditionalDataFieldNames array to indicate RadGrid DataFieldNames that should be sorted, grouped, ect and are not included as columns.
Gets or sets a value indicating whether items' data type should be retrieved from supplied enumerable's first item.
public virtual bool RetrieveDataTypeFromFirstItem { get; set; }
true if this function is enabled; otherwise, false. The default is false.
You should enable this property in scenarios in which the item type should not be retrieved from the enumerable's generic argument but from its first item's type. Such cases will be the use of various O/R Mappers where the enumerable is a entity base class and does not contains the actual object's properties.
Gets or sets a value indicating whether null values in the database will be retrieved as dbnull values.
public bool RetrieveNullAsDBNull { get; set; }
true if the null values in the database will be retrieved as dbnull values; otherwise, false. The default is false.
Gets a reference to the RowIndicatorColumn object, allowing you to customize its settings.
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridRowIndicatorColumn RowIndicatorColumn { get; set; }
The property setter does nothing and should not be used. It works around a bug in the VS.NET designer.
Gets a reference to the Style object that allows you to set the appearance of the selected item GridTableView control.
[Browsable(false)]
public Style SelectedItemStyle { get; }
A reference to the Style object that represents the style of the selected item in a GridTableView control. If style is not altered (is default) SelectedItemStyle is used.
Use the SelectedItemStyle property to control the appearance of the selected item in a GridTableView control. This property is read-only; however, you can set the properties of the Style object it returns. The properties can be set declaratively using one of the following methods:
- Place an attribute in the opening tag of the GridTableView control in the form Property-Subproperty, where Subproperty is a property of the Style object (for example, SelectedItemStyle-ForeColor).
- Nest a <SelectedRowStyle> element between the opening and closing tags of the GridTableView 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 or sets the name of the method to call in order to read data
public override string SelectMethod { get; set; }
Overrides:
Gets a set the options for GridTableView's self-hierarchy behavior.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridSelfHierarchySettings SelfHierarchySettings { get; }
Options for GridTableView's self-hierarchy behavior.
Gets or sets a value indicating if the GridFooterItem will be shown in the current GridTableView.
public bool ShowFooter { get; set; }
true, if the GridFooterItem will be shown in the current GridTableView; otherwise, false. The default value is false.
Gets or sets a value indicating if the GridGroupFooterItem will be shown in the current GridTableView.
public bool ShowGroupFooter { get; set; }
true, if the GridGroupFooterItem will be shown in the current GridTableView; otherwise, false. The default value is true.
Gets or sets a value indicating if the GridHeaderItem will be shown in the current GridTableView.
public bool ShowHeader { get; set; }
true, if the GridHeaderItem will be shown in the current GridTableView; otherwise, false. The default value is true.
If set to true (the default) GridNoRecordsItem is used to display no records template. This item is the only one displayed in the GridTableView in this case.
public bool ShowHeadersWhenNoRecords { get; set; }
Gets a collection of sort expressions for this table view instance, associated with the column or columns being sorted.
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridSortExpressionCollection SortExpressions { get; }
The collection of sort expressions associated with the column or columns being sorted.
Modifying the SortExpressions collection will result in change of the order of appearance of items in the table view. If AllowMultiColumnSorting is set to false this collection can only contain one item. Adding other GridSortExpression in the collection in this case will cause existing expression to be deleted or if GridSortExpression with the same same FieldName exist its SortOrder will be changed.
This property's value is preserved in the ViewState.
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. Default value is the value of SortHeaderContextMenuColumns.
Gets or sets the 'summary' attribute for the respective table.
public virtual string Summary { get; set; }
A string representation of the 'summary' attribute for the respective table.
This attribute provides a summary of the table's purpose and structure for user agents rendering to non-visual media such as speech and Braille. This property is a part of Telerik RadGrid accessibility features.
Gets or sets a string that indicates whether the table layout is fixed.
public virtual GridTableLayout TableLayout { get; set; }
A GridTableLayou value, indicating the table layout type. The default value is Fixed.
The value of the TableLayout property is a string that specifies or receives one of the following GridTableLayout enumeration values:
Auto Default (except in some scenarios, e.g. when using static headers with grouping or hierarchy). Column width is set by the widest unbreakable content in the column cells. Fixed Table and column widths are set either by the sum of the widths on the Columns objects or, if these are not specified, by the width of the first row of cells. If no width is specified for the table, it renders by default with width=100%.
Gets or sets the current time zone GridTableView is operating in
public string TimeZoneID { get; set; }
The time zone ID.
Gets or sets the name of the method to call in order to update data
public string UpdateMethod { get; set; }
Gets or sets a value indicating whether the GridTableView should use all retieved properties from the DataSource when binding, to perform operations like sorting, grouping, etc on DataFields that are not included in the column declarations.
public bool UseAllDataFields { get; set; }
false, if the GridTableView will not use all bindable properties from the DataSource when binding; otherwise, true. The default value is false.
You can also use the AdditionalDataFieldNames array to indicate RadGrid DataFieldNames that should be sorted, grouped, ect and are not included as columns.
[Browsable(true)]
[Bindable(true)]
public virtual int VirtualItemCount { get; set; }
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
protected void BuildDetailTablesFromDataSource(DataTable parentTable, GridTableView parentTableView)
Removes all edit items that belong to the GridTableView instance.
public void ClearEditItems()
Removes all selected items that belong to this GridTableView instance.
public void ClearSelectedItems()
protected override int CreateChildControls(IEnumerable dataSource, bool useDataSource)
Overrides:
Recreates all GridItems and chld controls, using the DataSource or the ViewState
protected override void CreateControlHierarchy(bool useDataSource)
'True' means that DataBind() is executing. 'False' means that Viewtate has been just loaded after postback.
Overrides:
protected override DataSourceSelectArguments CreateDataSourceSelectArguments()
Overrides:
protected void CreateMobileViews()
Binds the data source to the RadGrid instance.
public override void DataBind()
Overrides:
Call this member to bind partially RadGrid. Before calling this method the DataSource property should be assigned or you can use Rebind() method instead. Use DataBind() or Rebind() member to bind all GridTableViews in RadGrid.
Exports the grid data in CSV format using the properties set in ExportSettings
public void ExportToCSV()
Exports the grid data in Microsoft Excel format using the properties set in the ExportSettings.
public void ExportToExcel()
Exports the grid data in PDF format using the properties set in the ExportSettings.
public void ExportToPdf()
Exports the grid data in Microsoft Word format based on the selected ExportSettings.
public void ExportToWord()
The passed IDictionary object (like Hashtable for example) will be filled with the names/values of the corresponding column data-fields and their values. Only instances of type GridEditableColumn support extracting values.
public void ExtractValuesFromItem(IDictionary newValues, GridEditableItem editedItem)
the dictionary that will be filled
editedItemGridEditableItemthe item to extract values from
protected virtual void FilterDetailDataSource()
Finds the GridDataItem based on specified key name and key value.
Finds a collection of GridDataItem objects based on a IDictionary of key values.
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
public GridDataItem[] FindItemsByKeyValues(IDictionary dictionary)
The dictionary containing key values..
Returns:Generates the text representing the Export Output for Microsoft Excel XSLX format using the properties set in the ExportSettings.
Generates a SpreadProcessing Workbook that can be exported to a number of formats such as XLSX, PDF and others. For more information, check https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/general-information
Returns the column editor for the specified column for EditMode="Batch". Note that you should use GetBatchEditorContainer method for template columns which will return the panel container and then use a FindControl method to find your control.
public IGridColumnEditor GetBatchColumnEditor(GridColumn column)
The column for which the column editor will be returned.
Returns:Returns the column editor associated with the column.
Returns the column editor from the specified column UniqueName for EditMode="Batch". Note that you should use GetBatchEditorContainer method for template columns which will return the panel container and then use a FindControl method to find your control.
public IGridColumnEditor GetBatchColumnEditor(string columnUniqueName)
The column unique name for which the column editor will be returned.
Returns:Returns the column editor associated with the column.
Returns the Panel that holds the controls initialized from a template or editor for EditMode="Batch".
public Panel GetBatchEditorContainer(GridColumn column)
The column for which the container will be returned.
Returns:Returns the Panel container associated with the column.
Returns the Panel that holds the controls initialized from a template or editor for EditMode="Batch".
Returns a GridColumn based on its UniqueName.
public GridColumn GetColumn(string columnUniqueName)
The UniqueName for the requested column.
Returns:The GridColumn object related to the columnUniqueName.
Returns a GridColumn based on its UniqueName.
public GridColumn GetColumnSafe(string columnUniqueName)
The UniqueName for the requested column.
Returns:Returns the filter expression for the current table view object using the Entity SQL syntax. This would work only when EnableLinqExpressions property is enabled.
public string GetEntitySqlFilterExpression()
String value containing the ESQL filter expression
Obtains the GridTableHeaderCell in the header that corresponds to the column unique name passed as an argument.
public GridTableHeaderCell GetHeaderCellByColumnUniqueName(string uniqueName)
The targeted column unique name
Returns:A GridTableHeaderCell representing the column header cell
Get the item that appears when grid is in Insert Mode.
public virtual GridEditableItem GetInsertItem()
A reference to the newly inserted item for the respective GridTableView.
There is scenarios in which you need to make some changes with/depending on the inserted item.
If you want to predifine some controls values on item insertion, you should use the ItemCommand server-side event to access it:
[C#]
private void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.InitInsertCommandName)
{
e.Canceled = true;
e.Item.OwnerTableView.InsertItem();
GridEditableItem insertedItem = e.Item.OwnerTableView.GetInsertItem();
GridEditFormItem editFormItem = insertedItem as GridEditFormItem;
TextBox box = editFormItem.FindControl("txtEmployeeID") as TextBox;
box.Text = "11";
}
}
[VB.NET]Private Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
If (e.CommandName = RadGrid.InitInsertCommandName) Then
e.Canceled = True
e.Item.OwnerTableView.InsertItem()
Dim insertedItem As GridEditableItem = e.Item.OwnerTableView.GetInsertItem()
Dim editFormItem As GridEditFormItem = CType(insertedItem, GridEditFormItem)
Dim box As TextBox = CType(MyUserControl.FindControl("insertedItem"), TextBox)
box.Text = "11"
End If
End SubIf you want to get access to the newly added row and its values to update in a custom data source, you can use the InsertCommand event:
[C#]
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
{
GridDataInsertItem gridDataInsertItem =
(GridDataInsertItem)(RadGrid1.MasterTableView.GetInsertItem());
Hashtable ht = new Hashtable();
gridDataInsertItem.ExtractValues(ht);
//Loop through each "DictionaryEntry" in hash table and insert using key value
foreach (DictionaryEntry ent in ht)
{
//get the key values and insert to custom datasource.
}
}[Visual Basic]
Protected Sub RadGrid1_InsertCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
Dim gridDataInsertItem As GridDataInsertItem = CType(RadGrid1.MasterTableView.GetInsertItem,GridDataInsertItem)
Dim ht As Hashtable = New Hashtable
gridDataInsertItem.ExtractValues(ht)
'Loop through each "DictionaryEntry" in hash table and insert using key value
For Each ent As DictionaryEntry In ht
'get the key values and insert to custom datasource.
Next
End Sub
public GridItem[] GetItems(params GridItemType[] includeItemTypes)
The ItemType, which will be used as a criteria for the collection.
Returns:GridItem[]
Gets the currently RadGrid selected items.
public GridDataItem[] GetSelectedItems()
Returns an Array of GridDataItem objects representing the currently selected items.
protected virtual bool HandleDeleteCallback(int affectedRows, Exception ex, GridEditableItem item, bool suppressRebind)
protected virtual bool HandleInsertCallback(int affectedRows, Exception ex, GridEditableItem item, bool suppressRebind)
protected virtual bool HandleUpdateCallback(int affectedRows, Exception ex, GridEditableItem item, bool suppressRebind)
Places the GridTableView in insert mode, allowing user to insert a new data-item values. The CurrentPageIndex will be set to display the last page. You can use also the IsItemInserted to place the GridTableView in insert mode.
public virtual void InsertItem()
Places the GridTableView in insert mode, allowing the user to insert a new data-item values. The GridInsertItem created will be bound to values found in newValues dictionary; The CurrentPageIndex will be set to display the last page. You can use also the IsItemInserted to place the GridTableView in insert mode.
Places the GridTableView in insert mode, allowing the user to insert a new data-item values. The GridInsertItem created will be bound to values of the newDataItem object. The CurrentPageIndex will be set to display the last page. You can use also the IsItemInserted property to place the GridTableView in insert mode.
protected override void LoadControlState(object savedState)
Overrides:
protected override void OnDataPropertyChanged()
Overrides:
Perform delete operation, using the DataSourceControl API. Please make sure you have specified the correct DataKeyNames for the GridTableView.
public virtual void PerformDelete(GridEditableItem editedItem, bool suppressRebind)
The item that should be deleted
suppressRebindboolSet to true to stop error from binding
Perform asynchronous delete operation, using the DataSourceControl API the Rebinds the grid. Please make sure you have specified the correct DataKeyNames for the GridTableView. When the asynchronous operation calls back, RadGrid will fire ItemDeleted event.
public void PerformDelete(GridEditableItem editedItem)
The item that should be deleted
Perform asynchronous insert of the new item, diplayed by RadGrid when in edit mode, using the DataSourceControl API, then Rebind(). When the asynchronous operation calls back, RadGrid will fire ItemInserted event.
public void PerformInsert()
Perform asynchronous insert operation, using the DataSource control API. When the asynchronous operation calls back, RadGrid will fire ItemInserted event.
public virtual void PerformInsert(GridEditableItem editedItem, bool suppressRebind)
the item to be inserted
suppressRebindboolTrue to prevent from binding after the insert operartion completes.
Performs asynchronous insert operation, using the DataSourceControl API, then Rebinds. When the asynchronous operation calls back, RadGrid will fire ItemInserted event.
public void PerformInsert(GridEditableItem editedItem)
item to be inserted
protected override void PerformSelect()
Overrides:
Perform asynchronous update operation, using the DataSource control API. Please make sure you have specified the correct DataKeyNames for the GridTableView. When the asynchronous operation calls back, RadGrid will fire ItemUpdated event. The boolean property defines if RadGrid will Rebind() after the update.
public virtual void PerformUpdate(GridEditableItem editedItem, bool suppressRebind)
the item that is in edit mode and should be updated
suppressRebindboolset to true to prevent grid from binding after the update operation completes
Perform asynchronous update operation, using the DataSource control API and the Rebind method. Please, make sure you have specified the correct DataKeyNames for the GridTableView. When the asynchronous operation calls back, RadGrid will fire ItemUpdated event.
public void PerformUpdate(GridEditableItem editedItem)
The following online example uses PerformUpdate method:
Edit on double-click
Applies all view changes to control hierarchy before rendering
protected override void PrepareControlHierarchy()
Overrides:
protected virtual void PrepareDataSource()
Forces the Owner RadGrid to fire NeedDataSource event then calls DataBind().
public void Rebind()
The Rebind method should be called every time a change to the RadGrid columns/items has been made.
protected virtual void ResetAllowAutomaticDeletes()
protected virtual void ResetAllowAutomaticInserts()
protected virtual void ResetAllowAutomaticUpdates()
protected virtual void ResetAllowCustomPaging()
protected virtual void ResetAllowFilteringByColumn()
protected virtual void ResetAllowPaging()
protected virtual void ResetAllowSorting()
protected virtual void ResetAutoGenerateColumns()
protected virtual void ResetGridLines()
protected virtual void ResetHorizontalAlign()
protected virtual void ResetPageSize()
protected virtual void ResetShowFooter()
protected virtual void ResetShowHeader()
protected virtual void ResetVirtualItemCount()
Swaps columns appearance position using the column instances.
public void SwapColumns(GridColumn column1, GridColumn column2)
The first column.
column2GridColumnThe second column.
Swaps columns appearance position using order indexes of the two columns.
public void SwapColumns(int orderIndex1, int orderIndex2)
first column order index
orderIndex2intsecond column order index
You should have in mind that GridExpandColumn and RowIndicatorColumn are always in front of data columns so that's why you columns will start from index 2.
protected override void TrackViewState()
Overrides:
