Click here to Skip to main content
14,879,397 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If I bind gridview on page_load, then search button client side event fired but gridview getting null at static webmethod OR Other method of same page called inside static webmethod.

my Jquery Method:

function GetUserDetails() {debugger;
          var grdUserDetails = document.getElementById("ContentPlaceHolder1_grdUserDetails");
          if (ddlCities == null)
              ddlCities = 0;
              type: "POST",
              url: "UserDetails.aspx/UserListDetails",
              data: "{}"
              contentType: "application/json",
              dataType: "json",
              success: function (response) {// debugger;
                  // OnSuccess(response);
              error: function (response) {
                  // debugger;
          return false;

// web method //
    public static List<usp_get_userview_details_test_result> UserListDetails() //,
        using (Pel_DataEntities1 objPelData = new Pel_DataEntities1())
            grd = new GridView();
            var UserData = objPelData.USP_GET_USERVIEW_DETAILS_Test().ToList();
            UserDetails bb = new UserDetails(); // page class object
            //grdUser.DataSource = UserData;
           // bb.grdUserDetails.DataSource = UserData;
          // bb.grdUserDetails.DataBind();
            grd.DataSource = UserData;
            return UserData;
 public void asddf(GridView gg)
        grdUserDetails = gg;
       // grdUserDetails.DataBind();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900