AllInWorld99 provides a reference manual covering many aspects of web programming, including technologies such as HTML, XHTML, CSS, XML, JavaScript, PHP, ASP, SQL,FLASH, jQuery, java, for loop, switch case, if, if else, for...of, for...in, for...each,while loop, blogger tips, blogger meta tag generator, blogger tricks, blogger pagination, client side script, html code editor, javascript editor with instant output, css editor, online html editor, materialize css tutorial, materialize css dropdown list,break, continue statement, label,array, json, get day and month dropdown list using c# code, CSS button,protect cd or pendrive from virus, cordova, android example, html and css to make android app, html code play,telerik show hide column, Transparent image convertor, copy to clipboard using javascript without using any swf file, simple animation using css, SQL etc. AllInWorld99 presents thousands of code examples (accompanied with source code) which can be copied/downloaded independantly. By using the online editor provided,readers can edit the examples and execute the code experimentally.


Send the parameter through object in asp.net:-
     PageMethods is used to send the values from the client side (javascript,jquery) to server side program like in asp.net (aspx.cs) page. If we want to send more than 30 parameters then it will reduce the speed and may we have chance to confusion, so we can convert all that 30 parameters to objects and pass a single objects and receive from the server side and access.


For Example:-

1.Client Side
var obj = new Object();
obj.JobTitleID = 30;
obj.Month = 1;
obj.Year = 2014;
obj.Name="Ajay";
obj.Mark=988;
PageMethods.sendVal(obj);



2.Sever Side
[WebMethod]
public static void selectAssetName(object obj)
{
    JavaScriptSerializer JSobj = new JavaScriptSerializer();
    List<EquatedModel> listobj = JSobj.ConvertToType<List<EquatedModel>>(obj);
    listobj[0].JobTitleID;
    listobj[0].Month;
    listobj[0].Year;
    listobj[0].Name;   
    listobj[0].Mark;   
}

public class EquatedModel
{
    public int JobTitleID { set; get; }
    public int Month { set; get; }
    public int Year { set; get; }
    public string Name { set; get; }
    public int Mark { set; get; }
}


Advertisement

Screen shots:-
pass objects through pagemethods

1 comment:

Total Pageviews