mrówa
mrówa

Reputation: 5771

Is it better to create asp.net ajax control around js-only component than to do ajax by jquery?

Is it better to create asp.net client control around the component and let it handle talking with the server, querying data, saving data or to use jquery to query the server (and handle responses)?

I am rookie to asp.net, not sure about needed amount of work to achieve similar results to the fully javascript-based solution.

Component is 100% javascript, frequently asks server for data (every 0.5-2 seconds), lets user do some changes, that are later saved by the server, component is hosted as a part of asp.net site. Component queries for just a few types of data / up to 4-5 arguments per query, order of queries is irrelevant. Similar situation with saving data.

Upvotes: 0

Views: 90

Answers (2)

Guru Kara
Guru Kara

Reputation: 6462

Yes its better to create a ASP.NET composite control and Implement the IScriptcontrol interface.

And then define your JavaScript prototype and use the that for all client operations. These two links gives to fairly through explanation as to how to do it. Basically what you want is already supported by MS and most of the third part controls for ASP.NET are build this way.

Adding Client Capabilities to a Web Server Control

Adding Client Capabilities to a Web Server Control by Using ASP.NET AJAX Extensions

Upvotes: 1

Lajos Arpad
Lajos Arpad

Reputation: 76574

I think you should create a few prototypes which would handle all the functionality you need. It is of course better, because when you want to create a new request, you will just use your prototype.

Upvotes: 1

Related Questions