GridPanel - column reorder,width and hide columns

  1. #1

    GridPanel - column reorder,width and hide columns

    Hi sir,

    If the user changes size, column order, closes on column this change should be saved in a text file. when ever same user logins back or re opens the same page and it looks same where he left.

    Is there any chance to store the text file and restore it back instead of cookie.

    My requirement is simpe when user changes the column order,width and hide/show the columns and its should be save in text file and restore its back when same user login back.

    I saw its possible in using cookie. Can you please help on this.

    Thank you,
    Vamsi.
  2. #2
    Hello @vamsi!

    To do so you can use ASP.NET Session state to maintain the user state, and keep saving what you want to preserve in the .txt file as it changes -- as well as a means to identify the user account.

    So then, you'd have to have custom handlers to load the txt file once the user logs in.

    But you'd maybe better off with a supported state persistence technique using SQL, chances are, you would be able to find more documentation about it and have to delve "on your own" a bit less, as using SQL Server for persisting session state is well documented by Microsoft. Take a look at this article: Configure SQL Server to store ASP.NET session state.

    You would then be able to build the grid from server-side the way it is saved in the session state (be it SQL or .txt file), or feed the data to client-side's stateful handlers.

    At first, you should try using the default PostBack stateful provider; in case this doesn't work, then you'd have to create a custom one to do the specific tasks you require.

    Here are some insightful threads on the subject:

    - How to set Custom StateProvider
    - Implementing a state Provider to save the settings in the database
    - Saving Grid State to Database

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Thank you for reply.

    My question here..how we can save the gridpanel state into txt file and restore it back like apply state.

    Can you please send some piece of code

    THANK you,
    Vamsi.
  4. #4
    Hello @vamsi!

    I can't think any piece of code other than the ones in the links in our previous post. If that does not help you understand the concept and develop your own maybe we didn't really understand your requirements.

    Fact is, this is not supported without custom logic for your needs so no matter what we can come up with, it will be required for you to understand the overall process to be able to work with it; unfortunately there's no simple config where you can enable it on a grid; specific logic should take place to handle the server-side state handling.

    If you didn't already, we really recommend you review the threads pointed above and look for some more around the forums with, for starters, the "StateProvider" keyword. It was not some kind of "default response" to your inquiry; the threads were selected with your use case in mind; so we really hope checking them out would prove fruitful.

    Hope you understand.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Reorder columns and apply filter in one call
    By rgraham in forum 5.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 22, 2020, 4:57 PM
  2. Replies: 3
    Last Post: Dec 19, 2014, 9:52 AM
  3. Replies: 1
    Last Post: Jul 03, 2014, 8:32 AM
  4. [FIXED] [2.2] GridPanel - Column reorder
    By Viktor Reiser in forum Bugs
    Replies: 2
    Last Post: Jan 08, 2013, 7:52 PM
  5. Disable column reorder in gridpanel
    By nuno_Santos in forum 1.x Help
    Replies: 2
    Last Post: May 07, 2012, 3:58 PM

Posting Permissions