By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,584 Members | 1,803 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,584 IT Pros & Developers. It's quick & easy.

Save display value between postbacks

P: n/a
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

--
Satish Vellanki

Nov 7 '06 #1
Share this Question
Share on Google+
1 Reply


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

Brennan

sa*********@gmail.com wrote:
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

--
Satish Vellanki
Nov 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.