combobox with postback
-
i have cobmobox (chapters_combo) with visible= true and another two combos with visible = false i want when selecting chapter1 from chapters_combo then make the first combo visible = true and selecting chapter2 from chapters_combo then make the second combo visible = true chapters_combo has autopostback = true the problem each time selecting an item from chapters_combo the whole page update. is there any way do overcome that. i tried to use Ajax updatepanel but it takes about 15 sec to show the combo.
-
i have cobmobox (chapters_combo) with visible= true and another two combos with visible = false i want when selecting chapter1 from chapters_combo then make the first combo visible = true and selecting chapter2 from chapters_combo then make the second combo visible = true chapters_combo has autopostback = true the problem each time selecting an item from chapters_combo the whole page update. is there any way do overcome that. i tried to use Ajax updatepanel but it takes about 15 sec to show the combo.
Look into using the ASP.NET AJAX CascadingDropDown control extender.
-
Look into using the ASP.NET AJAX CascadingDropDown control extender.
-
AJAX means that your page updates without postbacks.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
i have cobmobox (chapters_combo) with visible= true and another two combos with visible = false i want when selecting chapter1 from chapters_combo then make the first combo visible = true and selecting chapter2 from chapters_combo then make the second combo visible = true chapters_combo has autopostback = true the problem each time selecting an item from chapters_combo the whole page update. is there any way do overcome that. i tried to use Ajax updatepanel but it takes about 15 sec to show the combo.
Are you looking to load the data dynamically, or is it small enough that you can emit it to the browser? UpdatePanels are fine if you know how to use them correctly. Slamming one over the entire page isn't always good. You should have it surround the dependent ComboBox and then trigger it based on the source combo box, so only the view state and code for the combo is round tripped. There are two other methods that will work. The first is to emit the list to the client and parse it - take a look at my blog post: http://csharperimage.jeremylikness.com/2009/03/json-and-c-using-generics-and-delegates.html[^] Basically, I serialize my objects using JSON and reconstruct them on the client, then when one combo box changes, I parse the appropriate sublist and dynamically the options for the second control. This is fast because there is no round trip to the server. Finally, use a tool like Fiddler to examine your post going back and forth. 15 seconds is a long time so somewhere you have latency - whether its processing, network, database access, etc depends on many factors. If you wrapped the whole page in the update panel with viewstate turned on you could have a huge messae and you just need to wrap a smaller portion, which the AJAX extender will address. You might event want to look at implementing ICallbackEventhandler and wiring up the call yourself to trim down the size of the payload. Essentially you bind to the onchange for the dropdown, then use WebForm_DoCallback to call back, parse out the new values, etc.
Jeremy Likness http://csharperimage.jeremylikness.com/
-
Are you looking to load the data dynamically, or is it small enough that you can emit it to the browser? UpdatePanels are fine if you know how to use them correctly. Slamming one over the entire page isn't always good. You should have it surround the dependent ComboBox and then trigger it based on the source combo box, so only the view state and code for the combo is round tripped. There are two other methods that will work. The first is to emit the list to the client and parse it - take a look at my blog post: http://csharperimage.jeremylikness.com/2009/03/json-and-c-using-generics-and-delegates.html[^] Basically, I serialize my objects using JSON and reconstruct them on the client, then when one combo box changes, I parse the appropriate sublist and dynamically the options for the second control. This is fast because there is no round trip to the server. Finally, use a tool like Fiddler to examine your post going back and forth. 15 seconds is a long time so somewhere you have latency - whether its processing, network, database access, etc depends on many factors. If you wrapped the whole page in the update panel with viewstate turned on you could have a huge messae and you just need to wrap a smaller portion, which the AJAX extender will address. You might event want to look at implementing ICallbackEventhandler and wiring up the call yourself to trim down the size of the payload. Essentially you bind to the onchange for the dropdown, then use WebForm_DoCallback to call back, parse out the new values, etc.
Jeremy Likness http://csharperimage.jeremylikness.com/