473,396 Members | 1,833 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.

[.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 "functionality" 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 3059
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 "functionality" 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
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...
1
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...
13
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...
0
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...
1
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 -...
1
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...
1
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...
1
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...
11
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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,...
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...

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.