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

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");


Ned Sahin

Blogger for 20 years. Former Microsoft Engineer. Author of six books. I love creating helpful content and sharing with the world. Reach me out for any questions or feedback.

1 thought on “Solved: Telerik RadGrid doesn’t retain data after a postback”

Leave a Comment