Problem: I want To Bind Telerik RadGrid From Server Side.
Solution: Its very ,simple and easy to bind RadGrid from server-side,Use NeedDataSource.NeedDataSource event is called whenever RadGrid is performing some operation like sorting,filtering etc.
Here is the sample code ,hope it works.
ASPX Code:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" >
<MasterTableView Width="100%" GridLines="None" >
<Columns>
<telerik:GridTemplateColum HeaderText="Name" UniqueName="Name">
<ItemTemplate>
<asp:Label ID="Name" runat="server" Text='<%# eval("Name") %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</MasterTableView>
</telerik:RadGrid>
Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
Dim Ds as DataSet
Ds=GetDataSETFromDataBase ' Use Function Or Procedure You Use To Fetch Data SET From DataBase
RadGrid1.DataSource = Ds.Tables(0)
End Sub
End Sub
PivotGrid data binding to local source
ReplyDelete