AJAX Page - AddParam/ResetParams methods

AddParam, ResetParams

AddParam

You can add an indefinite number of parameters for your AJAX Page ASP.NET control, using the AddParam() method.


Parameters:
  • name - The name of the parameter.
  • value - The value of the parameter (can be string, number, bool, collection).

The syntax is:

        ob_post.AddParam("Param1", Param1Value);
		

The parameters you add must have a corespondent on the server-side method that manipulates the data.
The server-side method needs to be declared public.

Client Side
		
        AddParam("yearBorn", 1982);
        AddParam("yearNow", 2006);
        AddParam("name", "John");
		
        alert(ob_post.post(null, "ComputeAge"));
		
		
Server Side
		
        public string ComputeAge(string name, int yearBorn, int yearNow)
        {
            int age = yearNow - yearBorn;
            return name + " is " + age + " years old.";
        }
		
Visit the Retrieve Values Server-Side tutorial for more details.


View AddParam example.

ResetParams

Removes all the parameters added using AddParam.

The syntax is:

        ob_post.ResetParams();
		
View ResetParams example.