How to: Telerik RadGrid loses it’s state of expanded and contracted groups whenever you databind

You may also like...

6 Responses

  1. Guy says:

    Solved my problem…


  2. your code is a mess!!!

  3. Developer says:

    Is there an other option besides a for each loop. My grid has many records and doing a for each loop would be too time consuming

  4. Developer says:

    Any other option other than than the for each loop as I have many records in the radgrid

    • Carlos says:

      Sorry for the late response. I haven’t used this control in a while perhaps they have addressed this issue in a new version. I could think of 3 alternatives although I am not sure how viable/helpful they would be:
      1) Perform the binding operation on the client side instead of the server side
      2) Use entity framework or other sort of query to just return the index of the collapsed items
      3) If there is a way to identify only what items have been collapsed track that in session rather than go through the entire array/list to re-record them. The restore operation seems fine, I’m guessing it is not as time consuming as storing the state.

      Finally, I could suggest you control the amount of data you show on screen. Oh wait, I just realized something. This code goes through your columns not rows. In that case the code should not take too long unless you have a super wide (guessing long means rows and wide columns) table which is doubtful. If the code on your screen is slow it could be because you are sending again the information in the grid from the server to the client. In theory the time it takes to load your screen the first time should be no more than the time it takes after you do a post back. This is because if you store the information in session you save the time from querying the db and if you perform the collapsing client side that should be even faster I would assume. I hope this helped and good luck!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: