Get JSON Data formate In Asp.net
(Without any third party libary file)
Steps 1: Nessary Namespace __ using System.Web.Script.Serialization;
Steps 2: put the Folloing code__
[WebMethod]
public void getAllTheData()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString());
con.Open();
List<employee> emp = new List<employee>();
SqlCommand cmd = new SqlCommand("spgetData", con);
cmd.CommandType = CommandType.StoredProcedure;
using (SqlDataReader sdr = cmd.ExecuteReader())
{
while (sdr.Read())
{
emp.Add(new employee
{
name = sdr["name"].ToString(),
year = sdr["year"].ToString(),
total = Convert.ToInt32( sdr["total"].ToString())
});
}
}
con.Close();
JavaScriptSerializer js = new JavaScriptSerializer();
Context.Response.Write(js.Serialize(emp));
}
public class employee
{
public string name { get; set; }
public string year { get; set; }
public int total { get; set; }
}
Description
Here the class is employee ... Its is a example of consume data in a webmethod
Material Design for web application In this article I’m going to show you how to how to apply material design in web application. we will take materialize CSS framework to design our login page . Materialize CSS is free open source frontend designing framework. It provides material design. It is like a bootstrap framework , but we can do many thing using this framework. < link href ="https://fonts.googleapis.com/icon?family=Material+Icons" rel ="stylesheet" /> < link rel ="stylesheet" href ="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" /> < script type ="text/javascript" src ="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></ script > < script type ="text/javascript" src ="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></ s...
Comments
Post a Comment