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

RadToolBarButton Checked/Unchecked State Persistance

3 Answers 73 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 24 Feb 2013, 05:22 PM
RadToolBarButton Checked/Unchecked State Persistance:

Hi,
I need to save the Checked/Unchecked State of RadToolBarButton so that even the webpage is refreshed the state of RadToolBarButton persists or is preserved [May be server side or in a cookie]. Is there a built in functionality that I can use or how can I do it?

<telerik:RadToolBarButton CommandName="Filter" PostBack="false" ToolTip="Search/Filter"
    CheckOnClick="true" AllowSelfUnCheck="true" Group="F">
</telerik:RadToolBarButton>

Thanks...
The Team.
http://www.megasearches.com/

3 Answers, 1 is accepted

Sort by
0
Ivan Zhekov
Telerik team
answered on 28 Feb 2013, 07:29 AM
Hello.

There are many ways you could do this:
-- cookie is indeed one of them; to do so you need to plug to cookies from code behind;
-- You could use the persistence framework to do so -- http://demos.telerik.com/aspnet-ajax/persistenceframework/examples/overview/defaultcs.aspx.
-- Alternatively, you could use any custom solution.

I am making a wild guess here, but if the toolbar button controls a setting that is applied to users, especially logged users, this setting should best be stored in a DB and extracted from there.

Regards,
Ivan Zhekov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ali
Top achievements
Rank 1
answered on 28 Feb 2013, 08:36 AM
Hi Ivan,
Thank you very much for your reply. RadPersistenceFramework looks great and I definitely will be using it in the future. But for now I need a quick client-side solution and I don't need the states to be saved in a permanent storage [so, cookie seems to be ideal].

I have a RadGrid and the RadToolBarButton named "Filter" (located in RadGrid's CommandItemTemplate) shows/hides the column filters of the Grid. But I don't want the filters to be shown always [initially the filters are hidden using javascript]. When user clicks on the RadToolBarButton the filters show up and user can use the filters in the RadGrid. But the problem is that when user checks the RadToolBarButton by clicking on it and searches the Grid Column using the filters, the RadGrid rebinds and all the filters gets hidden again.

I need to keep the RadGrid's column filters shown/hidden depending on the state (checked/unchecked) of the "Filter" RadToolBarButton and save the states of RadToolBarButton in cookie.

Similar to this example, rather than using radio button, I am using RadToolBarButton and want to save the state temporarily.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/filtering/defaultcs.aspx

Do you have any example that uses cookie?

Your help regarding this is highly appreciated.


0
Daniel
Telerik team
answered on 05 Mar 2013, 11:39 AM
Hello,

You could save the desired settings even if they are not persisted out of the box in the initial version of the Persistence Framework. This is shown in the example below:
Custom Settings
It is also possible to use custom storage provider that saves the settings in a cookie. I have attached a runnable demo to this thread.

Best regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ToolBar
Asked by
Ali
Top achievements
Rank 1
Answers by
Ivan Zhekov
Telerik team
Ali
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or