Skip to main content

Solved: Telerik RadGrid doesn’t retain data after a postback

You may come across this issue when you try to sort, filter or group your table that is built with Telerik RadGrid component. Each of these sorting, filtering, and grouping features trigger a postback. You may not see the data in your table after the postback is completed.


Make sure you define OnNeedDataSource attribute for your RadGrid object and handle NeedDataSource event. Telerik uses NeedDataSource event each time RadGrid is need to be bound with a data source.

ASPX file:

<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" CellSpacing="0"
GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource1" AllowPaging="true" PageSize="10">
     <MasterTableView AutoGenerateColumns="true" DataKeyNames="CustomerID">

Code-behind file:

protected void RadGrid1_NeedDataSource1(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
      RadGrid1.DataSource = GetDataTable("SELECT CustomerID, CompanyName, ContactName FROM Customers");


One thought to “Solved: Telerik RadGrid doesn’t retain data after a postback”

Leave a Reply

Your email address will not be published. Required fields are marked *