473,785 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[.Net 2.0 / AJAX] Drop Down Lists Populating/Repopulating

Hi all,

Looking for a bit of help if possible.

For about 2 weeks now I've been investigating the best way to populate
related drop down menus, and have their values pre-populated again if the
user clicks back with their selected options still selected - and I'm
getting to the point where I might just popup a big window, perhaps with
some flash in it and say "dont be lazy, select em again you great big freak
of nature" because I am that thoroughly fed up!

I've started using Ajax, dont pretend to be an expert, but from an example
online I've managed to get my three drop down's populate upon the selected
item being changed without the page refreshing - marvellous - so imagine my
delight when I added a button to my test page in order to create a postback
to find that when I then hit back in the browser its just as if the page has
been loaded for the first time again....

*sigh*

Does anyone have any experience with doing this? I'm not looking for a
component or pre-written drop-in code - just some help with what I have
would ideal...

I'm kinda concerned that with the Ajax approach I've adopted, the form
elements might be updated with content for the user to see, but there wont
actually be anything behind it, ie, on the page, thus when its submitted
there's no viewstate (stop me if I'm sound like a complete moron at any
point please), thus I cant rely on that to then update the boxes when the
user clicks back.

I would prefer to avoid the use of a session variable to store any
selections - feels a bit dirty...

Any help would be really appreciated, I have to places in my application
where this "functional ity" is required, one at the beginning, and one a page
on from the beginning, needless to say its causing me a huge time-slip on
this project....(I'd spit all the options out as hyperlinks if there were
not so many of em!)

Regards

Rob
Jan 30 '07 #1
6 3087
there are a couple approaches

1) save the list changes in session
2) save the list changes in a hidden field that client script updates
3) in oninint look in the form collection for the postback values and
inital the lists.
4) create a custom dropdown that supports a postback value not in the list.

-- bruce (sqlwork.com)

Rob Meade wrote:
Hi all,

Looking for a bit of help if possible.

For about 2 weeks now I've been investigating the best way to populate
related drop down menus, and have their values pre-populated again if the
user clicks back with their selected options still selected - and I'm
getting to the point where I might just popup a big window, perhaps with
some flash in it and say "dont be lazy, select em again you great big freak
of nature" because I am that thoroughly fed up!

I've started using Ajax, dont pretend to be an expert, but from an example
online I've managed to get my three drop down's populate upon the selected
item being changed without the page refreshing - marvellous - so imagine my
delight when I added a button to my test page in order to create a postback
to find that when I then hit back in the browser its just as if the page has
been loaded for the first time again....

*sigh*

Does anyone have any experience with doing this? I'm not looking for a
component or pre-written drop-in code - just some help with what I have
would ideal...

I'm kinda concerned that with the Ajax approach I've adopted, the form
elements might be updated with content for the user to see, but there wont
actually be anything behind it, ie, on the page, thus when its submitted
there's no viewstate (stop me if I'm sound like a complete moron at any
point please), thus I cant rely on that to then update the boxes when the
user clicks back.

I would prefer to avoid the use of a session variable to store any
selections - feels a bit dirty...

Any help would be really appreciated, I have to places in my application
where this "functional ity" is required, one at the beginning, and one a page
on from the beginning, needless to say its causing me a huge time-slip on
this project....(I'd spit all the options out as hyperlinks if there were
not so many of em!)

Regards

Rob

Jan 30 '07 #2
I've started using Ajax, dont pretend to be an expert, but from an example
online I've managed to get my three drop down's populate upon the selected
item being changed without the page refreshing - marvellous - so imagine
my delight when I added a button to my test page in order to create a
postback to find that when I then hit back in the browser its just as if
the page has been loaded for the first time again....
I think that's normal. One of the drawbacks of AJAX is that it can break the
back/forward behavior in a browser (since there really aren't any new pages
to go back to).

Why are people using the back button in this case? Can this be resolved via
other UI elements?

-Darrel
Jan 30 '07 #3
"darrel" wrote ...
I think that's normal. One of the drawbacks of AJAX is that it can break
the back/forward behavior in a browser (since there really aren't any new
pages to go back to).
Yeah, this I've noticed, each time my code runs it seems to behave like a
postback - thus making the Page.IsPostBack a little redundant :o/
Why are people using the back button in this case? Can this be resolved
via other UI elements?
It wouldn't be through choice, it's those annoying users we all try so hard
to please :o)

The application will be used by approximately 10,000 users, I have to assume
that at least one of them is likely to click back or hit those extra mouse
buttons, just try to cover all eventualities, I must admit, I didn't expect
something like this to take so long though! With all these clever widgets
and things around the net these days its a shame some of the "simpler" tasks
still seem to be a nightmare!

Regards

Rob
Jan 31 '07 #4
"bruce barker" wrote ...
3) in oninint look in the form collection for the postback values and
inital the lists.
So effectively repopulating them and specifying the selected item yes?
4) create a custom dropdown that supports a postback value not in the
list.
I have a "progess" meeting this afternoon and doubt I'll get a lot more time
on this to be honest, although that sounds like a better solution in the
long term.

Regards

Rob
Jan 31 '07 #5
The application will be used by approximately 10,000 users, I have to
assume
that at least one of them is likely to click back or hit those extra mouse
buttons, just try to cover all eventualities, I must admit, I didn't
expect something like this to take so long though! With all these clever
widgets and things around the net these days its a shame some of the
"simpler" tasks still seem to be a nightmare!
One option that might work is anytime you do a UI update via AJAX on this
page (change the value of one of the DDLs, set a session variable to
remember the state of the pulldown menus.

-Darrel
Jan 31 '07 #6
"darrel" wrote ...
One option that might work is anytime you do a UI update via AJAX on this
page (change the value of one of the DDLs, set a session variable to
remember the state of the pulldown menus.
Having put the original problem to one side momentarily, I've put my code
for the Ajax stuff into my "proper" page as opposed to the test page.

The test page just had 3 drop downs, the ajax stuff reloaded each child drop
down each time the parent drop down was changed, other than that the page
had no other controls, did nothing else.

Now I have the code on my proper page - but I think I'm in trouble now!

This is a significantly more complex page, there are effectively 3 pages in
one using panels, its for a registration process, so in the page load there
are a lot of if...then's checking to see at which stage of the process you
are, ie, step 1 not posted, step 1 posted etc etc...

I think this has just killed the Ajax functionality, as all it does now is a
form post - any thoughts?

I'm becoming more turned off by Ajax as I use it - I read someone else
querying why the 1.0 release had changed something, they made some comments
to why it was now doing a full postback - not sure if this is my problem or
not - but I had noticed that the Page.IsPostBack was always true whenever my
Ajax stuff fired - thought this was a bit odd...

Rob
Feb 1 '07 #7

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

Similar topics

3
14223
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want to insert the values and text to each drop down list. So i want to create a script that populates a certain Drop Down List with certain values when page loads such as:
1
2489
by: msnews.microsoft.com | last post by:
I'd like to hear your thoughts on best methods for populating drop down list controls. I have states and countries drop down lists that don't change often, so naturally I "hard code" them in the aspx page. But the problem is these tend to really slow the development -- it takes up to 15 seconds for the page to come up in VS.NET design environment, so I'm thinking about taking these out and populating the controls dynamically using the...
13
5258
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data structures? Thanks for any hints, Leszek Taratuta
0
1832
by: arunprabu | last post by:
Hi, I have a problecm with the AJAX request in my webpage. I have some filters on top of the page. I have a submit button and an empty div below the filters. Some of the filters have ajax requests to update the content within the filters. For example, I have 2 drop downs, one for state and another for country. When I select a country in the country drop down, an ajax request is sent to fetch appropriate list of states and updates the
1
16513
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX - microlink pattern tutorial : A microlink is a link that opens up
1
2474
by: AndiSmith | last post by:
Hi guys, I wondered if anyone could help me with this problem, or even shed some light on the direction I need to take to resolve it? I'm using .NET 2.0 (C# flavor) to build a large user-based website. I've created an AJAX based user control, which is dynamically placed on a page (once, or multiple times) if the user has the correct permissions to receive it. It contains two drop down lists - employee value and partner value; and a...
1
1567
by: 47computers | last post by:
I have a couple of DropDownLists in a DetailsView control (your classic country/state lists) and I need one to be populated based on the current selection of the other. Currently this works fine with a postback, but an AJAX solution would be a better way of doing things. I've been googling around for some examples and tutorials, but so far nothing is working. I'm really a beginner with AJAX and need a simple example or tutorial for...
1
1878
by: bdbeames | last post by:
I have a page with google maps up and running. When a user clicks on a location from the map I would like to populate a drop down with data from the database related to that location. I have it up and working wonderful. Well that was what I thought until I tried it is IE. All that I get is an empty drop down. I know the problem is related to filling the element with the xmlHttp.responseText, but no matter how many solution I have tried as...
11
3051
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7 and IE8. There is no issue when the controls are allowed to complete loading. Can you please tell me the best practice that handles this? Thanks.
0
9645
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
9480
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
10325
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7499
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
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
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.