Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reloading Combo based on a value selected in another Combo 2

Status
Not open for further replies.

sunila7

Technical User
Apr 11, 2001
1,087
US
Hi All,

I have a combo box which displays states from the DB and for each state there is a set of values to be picked from the DB and to be displayed in another combo.

The porblem is that, I have got it to populate the combo based on the values selected from the state combo, but the screen reloads each time a state is selected, so the screen flshes for a second and reloads, can this be avoided?

Thanks

Sunil
 
not unless you write a custom javascript solution. Or some other client side language solution.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Hi Zarcom,

How can this be done? Can u give an example or a pointer...

Thanks

Sunil
 
It may not be the greatest idea to use javascript to create new comboboxes. I can't think of the name of the server variable but there is some server validation of the control states/view states. I'm not sure how well aspx pages will handle post back from dynamically instantiated form elements. Javascript however is truely the only way to do what you want without the "flashing" postback. There may be better ideas out there, but I suspsect you are either going to have to do significant amout of nasty javascript and aspx, or live with the flashing.
 
Just thinking of this logically, you wouldn't need to create a new combobox. Just fill and remove items from one that already exists. I am not sure how you would go about this as I haven't used javascript extensively sorry. However, I would definetly try the javascript forum. Then write that script to the client using the RegisterStartupScript method.

JavaScript Forum is at forum216

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
You can get rid of the flashing by setting something in the aspx file's page header. It's called AutoEventWireup. Set it to true. It's set to false by default. I was reading something that said this helps with flickering.

MS has been wrong in the past. [noevil]
 
Another option you have is to enable smart navigation.

At the top of your page, where it has the @Page directive (this will be in the html view, not the code behind), add the line SmartNavigation="True"

Smart Navigation is supposed to reduce screen flicker on post backs, as well as persist the scroll position and focus between postbacks.

For what you need, the flicker on post backs is the key feature. Havn't tested it yet myself, but give it a shot and see if it works for ya

D'Arcy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top