c# - How do you get the style of an element on an asp.net page -


i have admin page accordion javascript show/hide divs.

<div class="accordion">     <h2>pending</h2>     <div id="pending" class="accordion-item">partialview</div>     <h2>current</h2>     <div id="current" class="accordion-item">partialview</div>     <h2>all</h2>     <div id="all" class="accordion-item">partialview</div> </div> 

when delete item, page refreshes , collapsed. want have remember ones open , ones closed.

the accordion javascript gives div style="display: none" or style="display: block"

is there way style before page reloaded , apply after loaded again?

if want see styles , changes actively on page recommend using firebug (a firefox plugin).

as saving state, there 2 approaches. first ajax approach. second js only, cookie-based approach.

for ajax method need write js function fires off whenever state changed. method sends state of of collapsible options server in quick behind-the-scenes query. server saves information session variable. when page reloaded server can plant js array last known state information each item on page.

for second method must set cookie holds variable state of of items. can simple array. works same ajax method except data saved on client-side browser instead of server. state cookie array instead of server array.

for either 1 of these recommend using jquery library. cookie method recommend using cookie plugin jquery (http://plugins.jquery.com/project/cookie). here quick howto article this: http://jquery-howto.blogspot.com/2010/09/jquery-cookies-getsetdelete-plugin.html

jquery - http://jquery.com/
jquery ui - http://jqueryui.com/
visual jquery (a great, easy use reference jquery) - http://visualjquery.com/
firebug - http://getfirebug.com/
firefox - (never leave home without it) http://www.mozilla.com/en-us/firefox/fx/


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -