Hi guys,
I'm trying to make a div tag retain its state through postback. here's my code
Now if you click the "toggle" button div tag id sub3 will display. If you click different button div tag blah will display.Code:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-1.4.4.js"></script> </head> <body> <button id="bsub3" onclick="return bsub3_onclick()">Toggle</button> <button id="bsub5">Different</button> <script> $('#bsub3').click(function () { $('#sub3').toggle(); }); $('#bsub5').click(function () { $('#blah').toggle(); }); </script> <form runat="server"> <asp:Button ID="Button1" runat="server" Text="refresh" /> </form> <div id="sub3" style="display: none">Message Box</div> <div id="blah" style="display: none"> <p>a;lksdjfl;aksdjfaskdfjk;alsdjflksdjfj;kl asdflkjas;dkfjas;dkfjas;dlkfjasdl;kfjdf adslf;kja;lsdkjf;ladksjfa;lsdkfjasl;dkjfa asd;fkjas;lkfjasd;lkfjdsklfj</p> </div> </body> </html>
If you click refresh then both the toggle and different div tags disappear. Is there a way so that when you click refresh that the both div tags stay visible through the postback?




Reply With Quote