Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {

            var pageSize = (Request["PageSize"] == null) ? 50 : Int32.Parse(Request["PageSize"]);

            var custs = new List<Customer>();


            for (int i = 1; i < pageSize; i++)
            {

                var cust = new Customer
                {
                    ID = i,
                    FirstName = "Samuel" + i.ToString(),
                    LastName = "Barone" + i.ToString()
                };

                custs.Add(cust);

            }
            dlCustomers.DataSource = custs;
            dlCustomers.DataBind();

        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "application/json";

            var cust = new Customer
            {
                ID = int.Parse(Request["id"]),
                FirstName = "Samuel",
                LastName = "Barone"
            };

            var ser = new DataContractJsonSerializer(typeof(Customer));
            ser.WriteObject(Response.OutputStream, cust);

        }