Save display value between postbacks

S

satish.vell

Hi,

I have a ASP.NET page inside which I toggle the display of a field
using javascript.

How can I save this display value between postbacks.

Here is my code:

<pre>
<%--Name fields--%>
<asp:HyperLink runat="server" id="namesLink" cssclass="searchLink">
<img id="arrowImg1" src="images/arrow_close.gif" alt="&gt;&gt;"
style="border:none;"/>Name</asp:HyperLink>:
<asp:panel id="names" cssclass="searchField"
runat="server">
<table><tr><td>First</td><td>Middle
Initials</td><td>Last</td></tr>
<tr><td><asp:TextBox runat="server" ID="FirstName"
Text=""></asp:TextBox></td>
<td><asp:TextBox runat="server" ID="MiddleName"
Text=""></asp:TextBox></td>
<td><asp:TextBox runat="server" ID="LastName"
Text=""></asp:TextBox></td></tr>
</table>
</asp:panel>
</pre>

In the Page_Load I have
<pre>
namesLink.Attributes.Add("onclick", "ShowOrHide('arrowImg1', '" +
names.ClientID + "')")
</pre>


I toggle the display of 'names' panel when the user clicks the
Hyperlink 'namesLink', how can I save the display value for 'names'
panel between postbacks?
If 'names' panel is expanded, i want it to appear expanded after
postback

Hope I am clear.
Thanks in advance
 
B

Brennan Stehling

Place your data into a HiddenField. You can change the value with
Javascript and ASP.NET will persist it on a PostBack.

Brennan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top