Saturday, March 24, 2012

call codebehind function in AJAX

I need to call codebehind function in AJAX like this:

My dropdown.attributes.Add("SelectedIndexChanged","updatetable(this.selectedValue)");

where updatetable() will call a codebehind function that run a query to update the table with the passed parameter of this.selectedValue.

Please advise how to make the above happen using ASP.NET AJAX.

Thanks .

look for how to call web service from ajax Client, then in you javascript call your webservice method like

function updatetable(value)

{

callyorMethod(parameters, OKReturn,onError);
}

function OKReturn(result)

{
//do whatever with data return from web service
}


I beg you to please kindly provide complete sample code.

Check this outhttp://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx


So I need to a web service for whatever codebehind function for AJAX to call?

You can also call a static method the same way. i think is better way to make a webservice in your project to separete call from Ajax to the page especially if you decide to develop with another framework than asp.net.


Thanks.

BTW, is that icon of yours Alain Delon?


yes is Delon in Borsalino when he was young and handsome like me.Big Smile


Et Alain est vieux et laid maintenant?

No comments:

Post a Comment