473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Save display value between postbacks

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
1 3197
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
2
by: Fred Newton | last post by:
Just wondering if there are any strong arguments one way or the other for storing a small value (6 bytes) in the ViewState vs. Session state. The value is needed in only one page in a large ASP.NET...
8
by: hb | last post by:
Hi, I need to declare a variable who's value can be preserve through the same ASP.Net page. I tried the following code, only the static variable s2 keeps its value=22 after lnk1_Click followed...
1
by: user | last post by:
I have a parent aspx page with a few iframes. Each of the iframes show an aspx page with a datagrid whose rows all show editable entry fields at all times. The user can enter values into the parent...
6
by: kurt | last post by:
Hi all, I have something that has me stumped. I have a webform that has several text boxes. Each of these boxes has the textchanged set so when the user enters text and leaves the textbox, it...
0
by: Zoodor | last post by:
I have a server control that contains an HtmlSelect. It currently uses postbacks to function (and works fine), but I am upgrading it to be able to use callbacks (using postback or callback,...
10
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got...
1
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image...
2
by: Evan M. | last post by:
Hello there, I have an interesting problem to takle. I'm creating a website that's going to be run in a local Intranet. The site uses a MasterPage / content page scheme, with the Master page...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.