RadGrid for ASP.NET

RadGrid Send comments on this topic.
DataSource Property
See Also 
Telerik.WebControls Namespace > RadGrid Class : DataSource Property


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

 

Namespace: Telerik.WebControls
Assembly: RadGrid (in RadGrid.dll)

Syntax

Visual Basic (Declaration) 
Overrides Public Property DataSource As Object
Visual Basic (Usage)Copy Code
Dim instance As RadGrid
Dim value As Object
 
instance.DataSource = value
 
value = instance.DataSource
C# 
public override object DataSource {get; set;}

Return Value

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

Example

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

Remarks

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.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also