RadGrid for ASP.NET

RadGrid Send comments on this topic.
NeedDataSource Event
See Also 
Telerik.WebControls Namespace > RadGrid Class : NeedDataSource Event


Fires when the grid is about to be bound and the data source must be assigned (is null/Nothing).

  

Event Data

The event handler receives an argument of type GridNeedDataSourceEventArgs containing data related to this event. The following GridNeedDataSourceEventArgs properties provide information specific to this event.

PropertyDescription
IsFromDetailTable Boolean property which specifies whether the GridTableView instance passed in the NeedDataSource handler is the MasterTableView or detail table.
RebindReason Determines what the rebind reason is which causes the NeedDataSource event to be raised
 

 

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

Syntax

Visual Basic (Declaration) 
Public Event NeedDataSource() As GridNeedDataSourceEventHandler
Visual Basic (Usage)Copy Code
Dim instance As RadGrid
Dim handler As GridNeedDataSourceEventHandler
 
AddHandler instance.NeedDataSource, handler
C# 
public event GridNeedDataSourceEventHandler NeedDataSource()
 

Event Data

The event handler receives an argument of type GridNeedDataSourceEventArgs containing data related to this event. The following GridNeedDataSourceEventArgs properties provide information specific to this event.

PropertyDescription
IsFromDetailTable Boolean property which specifies whether the GridTableView instance passed in the NeedDataSource handler is the MasterTableView or detail table.
RebindReason Determines what the rebind reason is which causes the NeedDataSource event to be raised

Remarks

Using this event eliminates the need for calling RadGrid.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.

Requirements

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

See Also