Persist js用户控制状态 [英] Persist js user controls state
问题描述
P.S。我的项目是ASP .NET MVC3
编辑
现在我记得有关memnto的设计模式。任何人都可以向我提供与这个想法有关的内容吗?
再次感谢!
我将此写成您的问题的评论,但我将其作为答案因为它可能是唯一的方法,而不必用某种侧插件劈它。
使用Viewstate与您无关或者不是JQuery UI插件。所有您需要做的是使用服务器端控件。
请注意,为此,您必须使用控制客户端名称,如:
$('#<%= MyDateTextbox.ClientID%>')。datepicker();
这样,您可以在服务器端控件上应用JQuery UI,并利用Viewstate恢复控件后退导航值。
My RIA application has a lot js UI controls (almost all of their is jQuery UI parts like datepicker, dialog, jqgrid). So then user works with some controls on one page and then go to another page and then clicks back all page components has initial state (textboxes are empty, grids are empty and so on). So how can I persist UI controls state and then restoring it between pages? It seems I need some like JS serialization/deserialization methods storing serialized data in user server session. How can I do it with minimal costs? How do you guys it in your projects? Any thougs, links, posts will be very appreciated. Thank you guys in advance!
P.S. My project is ASP .NET MVC3
EDIT
Just now I remember about memnto design pattern. Could anyone of you advice me something related to this idea? Thanks again!
I wrote this as a comment of your question but I'm putting it as an answer as it might be the only way to do this without having to "hack" it with some sort of side plugins.
The use of Viewstate have nothing to do with you using or not JQuery UI "addins". All you have to do is use server-side controls instead.
Note that for this you have to use the control client-side name, something like:
$('#<%= MyDateTextbox.ClientID %>').datepicker();
This way you can apply JQuery UI on server-side controls and take advantage of the Viewstate restoring the controls value on back-button navigation.
这篇关于Persist js用户控制状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!