RadGrid sort not working for some columns

4 posts, 0 answers
  1. sri harsha
    sri harsha avatar
    8 posts
    Member since:
    Aug 2018

    Posted 15 Oct Link to this post

    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.

  2. Attila Antal
    Admin
    Attila Antal avatar
    427 posts

    Posted 18 Oct Link to this post

    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.
  3. sri harsha
    sri harsha avatar
    8 posts
    Member since:
    Aug 2018

    Posted 28 Oct in reply to Attila Antal Link to this post

    Hi Attila,

    We have implemented the same way as suggested

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

    But problem still persists.

  4. sri harsha
    sri harsha avatar
    8 posts
    Member since:
    Aug 2018

    Posted 29 Oct Link to this post

    Hi Attila,

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

Back to Top