To do this, you will have to make changes both on the client side and on the server side. On the server side (or behind the code), make a Static method and decorate it with the [WebMethod] attribute.
public partial class _Default : System.Web.UI.Page { ... [WebMethod] public static void MethodToBeCalledUsingAjax(parameters) {
On the client side, inside the tab click function, use jquery ajax as below
var req = $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "Default.aspx/MethodToBeCalledUsingAjax", data: "{}", dataType: "json", success: function (msg) { } });
This ajax call, on demand, informs the server side that the tab is pressed and processes the code accordingly.
Please ignore the style ... I'm new to stackoverflow :)
source share