- Home
- Forum
- ASP.NET MVC
- Manually set control value in localStorage
Manually set control value in localStorage
Hello,
can i manually set/ change the stored value from the localStorage without reloading the whole page?
Dou you have functions for that? Or do i need to set it myself?
Arthur
SIGN IN To post a reply.
5 Replies
PO
Prince Oliver
Syncfusion Team
November 22, 2016 07:09 AM UTC
Hi Arthur,
Thank you for contacting Syncfusion support.
To set or change the value of dropdownlist from local storage, we can use our enablePersistence property of our Dropdownlist.
Refer to the following UG Document link:
Regards,
Prince
AR
Arthur
November 22, 2016 07:25 AM UTC
Hello,
this ony describes how to access it, not how to change the value in the control.
PO
Prince Oliver
Syncfusion Team
November 23, 2016 09:25 AM UTC
Hi Arthur,
Thanks for your update.
EnablePersistence property updates the control’s model value on local storage upon load and unload event. If we need to change the control’s value stored in browser’s local storage, then we need to manually edit the stored values in the cookies.
Control state stored with below mentioned format.
"$ej$" + control-plugin-Name + control-id
Ex:
"$ej$ejDropDownListskillsets".
To store the values, you can use the control’s persistState method, which can be accessed through control’s object. When you call persistState method, the control’s model value will be stored in the local storage.
In order to edit the control state value use window.localStorage.setItem and value can be accessed using window.localStorage.getItem methods.
Note: Manually handling the control state storage is not a recommended way. when page is refreshed the controls, value will be automatically set to the local storage, if enablePersistence property is used.
Please explain your scenario where you will be editing the controls value in local storage without altering the value in control
Let us know if you require any further assistance.
Regards,
Prince
AR
Arthur
November 23, 2016 10:19 AM UTC
Thanks,
will test it! My scenario is:
I have 4 Controls for my Grit i want to filter. The User should set first all Filter Controls and then click a Button to apply all the Filters to the unterlying Grid.
RU
Ragavee U S
Syncfusion Team
November 24, 2016 07:33 AM UTC
Hi Arthur,
We suspect that your requirement is to perform external filtering in grid. We can achieve this using the filterColumn method of the Grid. Please refer to the below online link for more information.
We can obtain the values from the control and pass the filterCollection array to the filterColumn method as explained in the above documentation.
Else, if you want to save the state of the grid and fetch the saved state, please refer to the knowledge base link where we have discussed on this topic.
Regards,
Ragavee U S.
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
AR Arthur
- Nov 21, 2016 02:21 PM UTC
- Nov 24, 2016 07:33 AM UTC