开发者

Ajax in existing asp .net project

开发者 https://www.devze.com 2022-12-23 22:48 出处:网络
I have a web page devoloped in visual studio 2008. I have 4 dropdowns and a repeater in the page.based on the selection(search criteria) from the dropdowns the repeater value will change.

I have a web page devoloped in visual studio 2008.

I have 4 dropdowns and a repeater in the page.based on the selection(search criteria) from the dropdowns the repeater value will change.

and one dropdown selection will bind values to the other dropdown also.

Since the page is causing a lot of postback we decided to implement ajax here.

I am yet to learn ajax.

Can anyone tell what is the best way to do this .which ajax control replace dropdowns?

i have alr开发者_开发百科eady server side code written on all dropdowns.

Please give me a good solution which i can implement in less time and reuse my code.

One more update: i have a master page used in the project.

I am using update panel of ajax which does not work if i use master page. (That means all the dropdown controls and repeater i put it in update panel.But still page postback occurs.) In a normal page(without master page) it works? why is this happening?

Thanks SNA


You are able to use UpdatePanel and place dropdowns inside it.


Your solution will depend on the AJAX framework you choose, but here are cascading dropdown examples in ASP.NET AJAX and jQuery


If your main reason for using AJAX is to remove the number of postbacks you are getting, then I would recommend against using Microsoft's built in solution, e.g updatepanels.

The learning curve will be higher but learn to use jQuery, maybe with a little help from jTemplate to help you build your drop downs on the page.

Using updatepanels will not reduce your postbacks as behind the scenes asp.net is doing a full page life-cycle, sending all content back to your client but only updating the update panel. jQuery will be far more efficient. (and the reason I use it!!)

Update

If you don't believe me, see... Why Update Panels are dangerous

Update #2

If you don't want to go the whole way of learning Ajax just yet (although I'd recommend it) you could always pre-load your page with all the possible drop down combinations and then swap them using javascript / javascript + jQuery.

Here is one example of how you may do it -- use jQuery for dependent drop down combos

Using this method you are more likely to be able to save the code you've already written to work out the drop down options.

0

精彩评论

暂无评论...
验证码 换一张
取 消