Question

I am new to Ajax .I have used AjaxPro In ASPX page for executing method .I have used below code for .NET 2.0

In ASPX:

$(function() {
        $( "#sortable" ).sortable({
            placeholder: "ui-state-highlight",
        update: function(event, ui) {
            var order = $('#sortable').sortable('serialize');             
                    var retStr = SortTest.Save(order);
        }

        });
        $( "#sortable" ).disableSelection();
            });     
    </script>

In CS file:

 using System.Data;
 using System.Data.SqlClient;
 using System.Configuration;
 using System.Collections;
 using System.Web;
using Ajaxpro;
 public partial class SortTest : System.Web.UI.Page
 {
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(SortTest));
}

 [AjaxPro.AjaxMethod]
     public string Save(string corder)
     {
    return "Test";  

}
}

Its working fine,but when i using in .NET 1.1 (AjaxPro.JSON.dll),its not working and even though i didn't get how to register.Plz do help me ajaxpro for .NET1.1 .

Was it helpful?

Solution

as i see in your there is no namespace. try to use namespace first. then Call your Ajax method by using Namespace.ClassName. some thing like this.

[AjaxNamespace("SortNameSpace")]
public partial class SortTest : System.Web.UI.Page
 {
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(SortTest));
    }

    [AjaxPro.AjaxMethod]
     public string Save(string corder)
     {
        return "Test";  
     }
}

while calling from javascript try like this

 var retStr = SortNameSpace.SortTest.Save(order).value;  //do something with returned  value
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top