views:

32

answers:

1

Hello,

I have for example ASP.NET site with textbox, button and many other controls. When user click on button i want to retrieve some data(string,number) from DB(MSSQLServer) and show these data to user without postback(ajax).

How can i do this?

Thanks

+1  A: 

There are two key components. A server-side method that can respond to a request for data and a client-side javascript function that can make an AJAX request to that method and consume the data, updating the web page.

On the server side you can use an actual web service or web application methods marked with the WebMethod attribute. These accept a request and respond, not with a web page, but usually a partial HTML snippet, XML, or JSON.

On the client side, I would look at using a framework that implements AJAX -- such as MicrosoftAjax or jQuery, though there are many others. It would be then be a matter of correctly configuring the client function to respond to the interaction trigger (button click) so that it calls the proper method with the right parameters and processes the response.

tvanfosson