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

Telerik Rad Grid Sort Is Lost With GroupbyExpressions

2 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Liby George
Top achievements
Rank 1
Liby George asked on 08 Jan 2014, 03:57 PM

I have a rad grid that I bind on page load (using basic data binding). 

gvCompetency.DataSource = competencies; //data sorted and returned by SP.
gvCompetency.DataBind();


I get the data from a Stored Procedure, sorted by some complex business rules.

I am using <GroupByExpressions> to group some fields together (See my code below). Once I do this, my original sort is lost which is very important. How can I keep my original sort? Need help fast. Thank you!

<GroupByExpressions>
<telerik:GridGroupByExpression>
           <SelectFields>
                     <telerik:GridGroupByField FieldAlias="Service Line"  FieldName="GroupName"></telerik:GridGroupByField>
                           </SelectFields>       
                           <GroupByFields>
                               <telerik:GridGroupByField FieldName="GroupName"></telerik:GridGroupByField>
                           </GroupByFields>
 </telerik:GridGroupByExpression>
</GroupByExpressions>

Please help.

Thanks

Liby George

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 10 Jan 2014, 10:04 AM
Hi Liby,

Simple data-binding can be used in simple cases when you do not require the grid to perform complex operations such as
Inserting, deleting, and updating records through custom edit forms (WebUserControl or FormTemplate), Grouping, Hierarchy relations, Filtering, Sorting, Paging etc.
For advanced features such as those listed above, RadGrid must be bound using declarative data sources or through the NeedDataSource event. When using declarative data sources or the NeedDataSource event, RadGrid can automatically accommodate the appropriate database operations without the need for you explicitly handle any sorting, paging, grouping, and so on.

Thanks,
Princy
0
Liby George
Top achievements
Rank 1
answered on 14 Jan 2014, 02:25 PM
Thank you Princy!

With Advanced Databinding I am able to get what I want.

Thanks again for clarification.

Liby 
Tags
Grid
Asked by
Liby George
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Liby George
Top achievements
Rank 1
Share this question
or