Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2005, 01:46 PM
Registered User
 
Join Date: Jan 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default postback issue with drop downlists with javascript

I have a problem with which I am struggling for many days.
I have a page which has six drop down list (which are webform elements and not html elements). Auto postback property is enabled for all the elements. The data in the dropdown lists are related in a hierarical fashion. Now to give you the general idea of the working of the page, suppose, When the client changes the selection in any of lists in the page (say list number 2), it updates the items of the subsequent lists (that is lists 3, 4, 5, 6). The process is database intensive, so it takes quite a while before any results comes up.
What I want is to prevent the client from changing the selection before their previous request is serviced, by disabling the dropdown lists in the page.
I am trying to use Javascript to disable the lists by adding a "OnChange" attribute to the dropdown list, in the Page_Load event of the page.
            ddllist1.Attributes.Add("OnChange", "disable();")
            ddllist2.Attributes.Add("OnChange", "disable();")
        ...........
            ddllist6.Attributes.Add("OnChange", "disable();")
The disable function is defined on the <Head> of the aspx page. Now the trouble is, this "OnChange" event is suppressing the "OnSelectedIndexChanged" event of the dropdown lists!! So though the lists are getting disabled, when the client is changing the selection, the code in the "OnSelectedIndexChanged" is not executing and the lists are not getting updated.
Please suggest.


 
Old January 7th, 2005, 04:45 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Do you mean prevent that after making a selection disable the current listboxes before the postback occurs or prevent them changing the fresh page before it has loaded. If the latter then add code to disable the listboxes until body.onload fires. If the former then post the source HTML of the listboxes, NOT the asp.net source.

These sort of problems have become quite common now that asp.net has abstracted the client side scripting by making all events submit back to the server. In the next version of asp.net you can aviod this and simply refresh the listboxes contents without a full postback.


--

Joe (Microsoft MVP - XML)
 
Old January 7th, 2005, 01:31 PM
Registered User
 
Join Date: Jan 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello joefawcett,

Thanks for replying me back. It helped.

cheers

 
Old January 24th, 2005, 06:54 AM
Registered User
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Will you please explain it in detail. I'm also facing the same problem






Similar Threads
Thread Thread Starter Forum Replies Last Post
ajax drop downlists msathyaprasad90 ASP.NET 1.0 and 1.1 Professional 1 June 28th, 2006 02:54 AM
drop down with large data on postback gives error madhusrp ASP.NET 1.0 and 1.1 Professional 5 March 16th, 2006 02:55 AM
postback issue with drop downlists emachines ADO.NET 3 March 26th, 2005 01:36 PM
postback issue with drop downlists emachines General .NET 1 January 9th, 2005 09:42 PM
postback issue with drop downlists with javascript emachines Javascript How-To 1 January 6th, 2005 01:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.