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

RadGrid sort not working for some columns

3 Answers 305 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sri harsha
Top achievements
Rank 1
sri harsha asked on 15 Oct 2019, 10:25 AM

Hi Team,

I am using a radgrid control in my asp.net web page which is dynamically created and added to the page. Columns added to the grid are also dynamic. Sort expression is being used to prioritize sort for 3 default columns which are also dynamic. I am changing the masterview header text due to the business requirement.

Now, the problem is, if i am changing the mastertableview header text, sorting is getting disabled to all number based columns . It is working only for all other string and date based columns. If i don't change mastertableview header text, sorting is enabled for all columns as expected. I tried placing the code to change mastertableview header text in databound and prerender but still no luck. I tried rebind also but not working.

Any sort of help is appreciated. 

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 18 Oct 2019, 07:00 AM

Hi,

I assume that changing the columns text is done similar to headerItem["ColumnName"].Text, if that is the case it is expected to disable sorting.

Here is a forum post describing how to change the Column headertext in the code behind: Changing RadGrid Column Header Text when Sorting is Enabled

When sorting is enabled, the cell content will contain a Button in it. By changing the cell.Text (headerItem["ColumnName"].Text) overwrites the button with a literal and thus loosing the sorting option. Instead, you will need to access the control in the cell, and set that control's Text.

 

Kind regards,
Attila Antal
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
sri harsha
Top achievements
Rank 1
answered on 28 Oct 2019, 07:21 AM

Hi Attila,

We have implemented the same way as suggested

(cell.Controls[0] as LinkButton).Text = "Success";

But problem still persists.

0
sri harsha
Top achievements
Rank 1
answered on 29 Oct 2019, 06:52 AM

Hi Attila,

We have found the issue. Culprit was one of our javascript function and was fixed.

Tags
Grid
Asked by
sri harsha
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
sri harsha
Top achievements
Rank 1
Share this question
or