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

RadGrid column sorting from a bound List

6 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eli
Top achievements
Rank 2
Eli asked on 23 Apr 2019, 01:09 AM

Hopefully someone can point me in the right direction.

 

I have a Grid that i populate from a list that i get from my backend. it works great like this. i do have paging that works, but sorting is one i am having trouble with.

 

I set the allowsort property to true, but the columns do not allow me to click on them to sort.

 

Any Suggestions?

6 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 25 Apr 2019, 02:45 PM
Hi Elisha,

Ensure that you are binding the grid via the NeedDataSource event:
https://www.telerik.com/support/kb/aspnet-ajax/grid/details/how-to-bind-radgrid-properly-on-server-side

And if you are using template columns, make sure that have their DataField and SortExpression properties set:
<telerik:GridBoundColumn DataField="ShipName"
    FilterControlAltText="Filter ShipName column" HeaderText="ShipName"
    SortExpression="ShipName" UniqueName="ShipName">

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Eli
Top achievements
Rank 2
answered on 03 May 2019, 08:49 AM

Thank you for your Help, However i am still unable to get sorting working.

At least now the grid does not disappear completely when i try to click on the sort option.

i did add a OnNeedDataSource="grdPNGrid_NeedDataSource" to my page and

to my code i added

protected void grdPNGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            if (!e.IsFromDetailTable)
            {
                grdPartyName.DataSource = lstSearchResults;
            }
        }

Still i cannot seem to get sorting to work at all. the columns highlight as i would apply sorting, i even get the little arrow to signify ascending and descending sort but it simply will not.

I did have the grid inside of an updatepanel, i tried removing it, but it still does not sort. i also tried adding the radajaxmanager in a way that work, but even with it and the grid outside of the updatepanel, it did not load at all. so once i removed the updatepanel completely and kept the ajaxmanager, it still did not sort. i ususlly have to keep the radajaxmanager out as it causes problems with using the updatepanel.

 

I am totally confused at this point.

0
Eyup
Telerik team
answered on 08 May 2019, 06:16 AM
Hi Elisha,

I am sending a sample RadGrid web site with working sorting functionality. You can use it as a base reference and built your configuration on top of it step by step.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Eli
Top achievements
Rank 2
answered on 17 May 2019, 04:06 AM

Awesome, Thank you

. but i do not see what you have sent. i do not have anything in my email or here.

0
Eyup
Telerik team
answered on 17 May 2019, 03:23 PM
Hello Eli,

Yes, you need to have RadGridSortBasicSample.zip sample attached to the previous post. I am also attaching it to this reply.

If you don't see the sample once again, you can check for spam filter of your company.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Eli
Top achievements
Rank 2
answered on 17 May 2019, 08:20 PM

Awesome, again Thank You.

for me the previous post did not have the file attached but this one did.

i will see what i can do with it.

Tags
Grid
Asked by
Eli
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Eli
Top achievements
Rank 2
Share this question
or