srmark
srmark

Reputation: 8162

Any downsides or better alternatives to calling .NET Page Methods with jQuery?

I need to come up with a smarter/simpler way of doing ajax calls in our current .net webforms app. I know jQuery basics and I like it alot. I'm thinking of proposing to my team the use of jQuery to directly call .net Page Methods as described here.

Does anyone know of any problems/limitations with this approach? Is there a simpler way of doing things? MVC is not an option.

Thanks

Note: You can assume that I'm happy with using JSON. I'm basically asking for any known flaws.

Upvotes: 0

Views: 540

Answers (2)

David Robbins
David Robbins

Reputation: 10046

I saw that you've looked at Dave Ward's articles on Encosia. We have used these techniques in production and they have solved some major architectural hurdles that we faced. You'll find that you can easily work this technique into you code without using MVC.

If you are going as far as calling page methods with jQuery, I would consider reading Dave's article regarding micro-templates, as this technique is built upon the page method approach. This nice by-product of this approach is that you will have greater flexibility with configuring your website as any change to presentation will NOT necessitate a re-compile and re-deploy.

Upvotes: 2

Ian Roke
Ian Roke

Reputation: 1784

I can't think of any major drawbacks except that it is not exactly how a traditional .NET application works in the sense that a lot of additional code has to be written in the 'presentation layer' for it to work.

However that aside, and any additional learning/development isn't a problem, then go for it.

Upvotes: 2

Related Questions