473,776 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Persisting Values

I have a form that has a dropdown list that will cause a post to the same
page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of themselves,
so to speak...but I didn't know if there was a simpler/more efficient way.

Thanks,
James
Jul 19 '05 #1
5 2135
The only solution that I found was to write the VALUE using
value=<%respons e.write request("userNa me")%>. For the list boxes, I
chopped of the HTML into two segments such as...

<%if request("airlin e") <> "" then%>
<option value="<%respon se.write request("airlin e")%>"<%respons e.write
request("airlin e")</option>
<%else if%>
<option value="">---Select Airline---</option>
<%end if%>
[rest of the option's here]

This puts the selected option at the top of the list.

I STRONGLY recommend avoiding the specifying which options is SELECTED.
I had mutliple problems with this when I was testing across different
browsers with and without the a particular option selected. Writing the
value from the request as the first option achieves the same effect as
if it were written using SELECTED.

David H
James Baker wrote:
I have a form that has a dropdown list that will cause a post to the same
page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of themselves,
so to speak...but I didn't know if there was a simpler/more efficient way.

Thanks,
James


Jul 19 '05 #2
Thanks for the reply. Only issue I have with that 'selected' issue is, I
have a multi-select box. Am I SOL?

"David C. Holley" <Da**********@n etscape.net> wrote in message
news:u1******** ******@TK2MSFTN GP11.phx.gbl...
The only solution that I found was to write the VALUE using
value=<%respons e.write request("userNa me")%>. For the list boxes, I
chopped of the HTML into two segments such as...

<%if request("airlin e") <> "" then%>
<option value="<%respon se.write request("airlin e")%>"<%respons e.write
request("airlin e")</option>
<%else if%>
<option value="">---Select Airline---</option>
<%end if%>
[rest of the option's here]

This puts the selected option at the top of the list.

I STRONGLY recommend avoiding the specifying which options is SELECTED.
I had mutliple problems with this when I was testing across different
browsers with and without the a particular option selected. Writing the
value from the request as the first option achieves the same effect as
if it were written using SELECTED.

David H
James Baker wrote:
I have a form that has a dropdown list that will cause a post to the same page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of themselves, so to speak...but I didn't know if there was a simpler/more efficient way.
Thanks,
James

Jul 19 '05 #3
<<
I have a form that has a dropdown list that will cause a post to the
same page when it's changed. The problem I'm running into is that all of
the controls reset to their default values (obviously expected
behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of
themselves, so to speak...but I didn't know if there was a simpler/more
efficient way.


Perhaps this may hopefully give some ideas, it's got a downloadable
sample, and does retain values after the post back:

ASP Design Tips - Dependent Listboxes
http://www.bullschmidt.com/devtip-de...tlistboxes.asp

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4
Well if you're using a multiple-select box, the solution is simple -
DON'T! (It only hurts when I bend it like this...)

I'm clueless at that point, since I haven't encountered that problem
yet.

David H

www.gatewayorlando.com

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5
Hmmmm....but you could try something where you kind of 'fool' your
visitor. When the page resubmits to itself, if there's an option in the
list box selected you could write a list box populated ONLY with
selected values - each with the SELECTED spec in the <option> tag. Then
provide the user when a CHANGE or CLEAR button that resubmits back to
the page, but with a querystring value that tells the page to draw the
list box with ALL possible values.

EVENT: Initial Page Load
ACTION: Populate list box with all possible values

EVENT: Self-submit - no value in the querystring or no values selected
ACTION: Populate list box with all possible values

EVENT: Self-submit - no value in the querystring, but values selected
ACTION: Populate list box with values from the request with each one
having the SELECT specified
Show the CHANGE/CLEAR button

EVENT: Self-submit - value in the querystring
ACTION: Populate list box with all possible values

I'm a bit frazzeled from work but at least that might get you going in
the right direction.

David H

James Baker wrote:
Thanks for the reply. Only issue I have with that 'selected' issue is, I
have a multi-select box. Am I SOL?

"David C. Holley" <Da**********@n etscape.net> wrote in message
news:u1******** ******@TK2MSFTN GP11.phx.gbl...
The only solution that I found was to write the VALUE using
value=<%respo nse.write request("userNa me")%>. For the list boxes, I
chopped of the HTML into two segments such as...

<%if request("airlin e") <> "" then%>
<option value="<%respon se.write request("airlin e")%>"<%respons e.write
request("airl ine")</option>
<%else if%>
<option value="">---Select Airline---</option>
<%end if%>
[rest of the option's here]

This puts the selected option at the top of the list.

I STRONGLY recommend avoiding the specifying which options is SELECTED.
I had mutliple problems with this when I was testing across different
browsers with and without the a particular option selected. Writing the
value from the request as the first option achieves the same effect as
if it were written using SELECTED.

David H
James Baker wrote:
I have a form that has a dropdown list that will cause a post to the
same
page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of
themselves,
so to speak...but I didn't know if there was a simpler/more efficient
way.
Thanks,
James



Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3089
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own words, their own definitions plus an example of how the word is used in practice. It'll be all client side with - cookies? to get persistence so that the words won't disappear on me each time the page is closed (which is what happened when I
4
3621
by: Dave Veeneman | last post by:
When does serializing objects make more sense than persisting them to a database? I'm new to object serialization, and I'm trying to get a feel for when to use it. Here is an example: I'm writing an accounting application. I have a chart of accounts in the form of a containment hierarchy. A GeneralLedger contains a number of Accounts, and each of these Accounts can contain a Aubledger, which contains its own Accounts, and so on. The...
2
1105
by: mike | last post by:
Howdy I need to port a VB6 app. Its GUI is persisted to an .ini file - ie all the control captions, positions, whether visible, tooltips, that kind of thing. In C# is there an easier way to accomplish this? I tried to Serialize a button without much luck, and further googling leads me to believe that you need to write a wrapper object and serialize the wrapper. I'm looking for ideas on how to do this. Be grateful for any bright ideas
2
1056
by: Hai Nguyen | last post by:
I have several different tables with textboxes I want user fill out some information into those boxes and after hit save, I want to store all those values from those textboxes into database I don't know why after I hit button save, all the values are gone. Pleaes tell me how i can keep those values? We Thanks
1
1670
by: lim | last post by:
What is the possible error that occurs when the Page_load event is not triggered during execution. In my page there's some basic server control. Is there any loops holes?
2
1512
by: Chris Ashley | last post by:
My app seems to lose its viewstate completely when I modify the querystring. Anything I can do about this? Cheers, Chris
2
3277
by: xenophon | last post by:
I added a Hidden Form Field to a form in the code behind. The value is being set in JavaScript client-side, but it is not persisting to the server in the PostBack. I know the value is being set properly because it displays in the document.write method. Create a simple page and paste the below in the code-behind (ASP.NET 1.1-SP1) using System;
5
4839
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by using GridView.SelectedValue to get the key value of the currently selected Row and then by itterating...
1
2091
by: David Veeneman | last post by:
I'm backporting a component to .NET 1.x, and it required me to use a custom collection, StringList, instead of List<string>. StringList is derived from CollectionBase and is marked serializable. Here's my problem: I can't get design-time property values to persist. Here is my property declaration:
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.