Is it possible in ASP.NET. I know we can easily achieve this is JSF, RichFaces or in ADF Faces.
If possible, can you show me an example?
Is it possible in ASP.NET. I know we can easily achieve this is JSF, RichFaces or in ADF Faces.
If possible, can you show me an example?
I can think of several ways to do this:
- Asynchronous Postbacks
- WebMethods
- Server Side event
- URL query string
The first two are commonly referred to as AJAX and there are many libraries out there that can help you make the AJAX calls.
- jQuery
- Microsoft Ajax
The third one is not AJAX, meaning that a full postback will occur and the page will refresh but accomplishes the same goal "Call Backend Method From JavaScript and Parameter Passing". You can setup the JavaScript call using the method GetPostBackEventReference
.
The last one is simply using a URL query string for the parameter. You would have to process this one via AJAX, otherwise the page will be redirected to the new page which is not what you want to do. The goal is to execute some backend method and either disregard the response (fire and forget) or process the response which could be HTML, XML, JSON, etc..
The advantages of 1, 3 and 4 is the full backend support of your underlying framework. The page is initialized, Page_Load fires, ViewState is sent back to the server, etc...
The advantage of 2 is that it's very lightweight. No ViewState is sent back to the server, the page doen't initialize, Page_Load doesn't fire, etc. BUT you do have full access to Session state if you want it.
So, it really boils down to your current needs but take your pick.
Your question is a bit vague but I believe what you need can be done by using WebMethods. This link should help.
It basically involves using a static function with the WebMethod attribute on it creating a web service.