This is a migrated thread and some comments may be shown as answers.

Grid NeedDataSource Problem

4 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saranya
Top achievements
Rank 2
Saranya asked on 25 Aug 2009, 06:02 AM
Hi,

I am using radgrid. I have three dropdownlists - dd1,dd2,dd3 and a button. I need to choose a data from dd1. Upon the choice my dd2 will get loaded and after choosing a data from dd2, my dd3 will be loaded. After selecting value from dd3, i will click on the button to generate data in the grid.

Sorting, paging, filtering everything works fine without any problem.

I have generated records on the grid. I click on the header for sorting. It gets sorted. When it is in the sorted state, if I select another data from dd1 and then dd2, then dd3 and click on the button, I am getting error stating "customer name not found in data set...". The new data in dataset doesnt have customer name. My previous dataset has column customer name and it is searching for the same columns. I think that is the problem. Retaining old dataset values after sorting or filtering or paging. The moment I reset the sort condition (by clicking on small arrow near column name header) and do these operations, i dont get any error.

How to resolve this?

Thanks
Saranya

4 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 26 Aug 2009, 03:32 PM
Hello Saranya,

RadGrid's sort, group and filter expressions, as well as the current page index are all preserved on rebind. You need to clear them all before rebinding to data with a different set of columns.

Kind regards,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Saranya
Top achievements
Rank 2
answered on 27 Aug 2009, 03:49 AM
Hi, Please tell me how to clear the sort, page index etc? Thanks. Saranya
0
Accepted
Shinu
Top achievements
Rank 2
answered on 27 Aug 2009, 05:37 AM
Hi Saranya,

Give a try with following code snippet and see whether it meets your requirement.

CS:
 
        RadGrid1.MasterTableView.SortExpressions.Clear(); 
        RadGrid1.MasterTableView.CurrentPageIndex = 0; 
        RadGrid1.MasterTableView.Rebind(); 


Thanks
Shinu
0
Saranya
Top achievements
Rank 2
answered on 27 Aug 2009, 06:07 AM
Hi,

Thanks. It solved my problem.

Regards,
Saranya
Tags
Grid
Asked by
Saranya
Top achievements
Rank 2
Answers by
Veli
Telerik team
Saranya
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or