Author Topic: Using "Remote" method with ASP.net Webforms  (Read 3522 times)

svk123

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 9
    • View Profile
Using "Remote" method with ASP.net Webforms
« on: June 15, 2015, 03:19:18 pm »
Hello,

I have been trying to get data into PQ grid from a asp.net web form with a webmethod using the "remote" option. However my call is never reaching the server webmethod bindGrid1. I would appreciate if you could tell me where I am going wrong. I am getting alert for "1a" but no alert for "1b" and the method is also not getting called on the server. Please see the code below

JavaScript:
Code: [Select]
obj.dataModel = {
            location: "remote",
            sorting: "local",
            paging: "local",
            dataType: "JSON",
            method: "GET",
            curPage: 1,
            rPP: 10,
            getUrl: function () {
                alert("1a");
                return { url: "F1845.aspx/bindGrid1"
               
                };
            },
            getData: function (dataJSON) {
                alert("1b");
                var data = dataJSON.data;
                return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: data };
                //return { data: data };
            }
        };


VB.net in ASP.net class F1845:
Code: [Select]
    <WebMethod()> Public Shared Function bindGrid1() As String
        Dim objquries As Quries
        Dim ds As New DataSet()

        Dim dt As New DataTable()
        Dim scriptString As String = ""
        objquries = HttpContext.Current.Session.Item("login")
        ds.Clear()
        svkstx$ = "QW24 '" & objquries.getId() & "'"
        ds = objquries.dsgrid(svkstx$)
        dt = ds.Tables(0)
        svkstx$ = Module1.GetJson(dt)
        sb$ = "{""totalRecords"":10, ""curPage"":1,""data"": " & svkstx$
        svkstx$ = svkstx$ + "}"


        Return svkstx$
    End Function
« Last Edit: June 15, 2015, 03:21:39 pm by svk123 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6255
    • View Profile
Re: Using "Remote" method with ASP.net Webforms
« Reply #1 on: June 16, 2015, 12:29:03 pm »
1. check whether the url is correct, i.e., open the url F1845.aspx/bindGrid1 in a browser.

2. Implement the dataModel.error callback and check the values of textStatus and errorThrown in callback.

http://paramquery.com/pro/api#option-dataModel-error