title: how to display data from database into a html table using jquery and c#
body: <p>how to display data from database into a html table using jquery and c#.
    ..help me
  here i used one html page only which i need and webmethod(cs) and jquery. 
     when i click that button it should display in html table with my database values which stored , using jquery and cs in html page(for client side only),
   here my app code</p>
  
  <pre><code>    wservice.cs
       ____________
        public class LeaveApplicationDisplay
               {
                public string Branch { get; set; }
                public string Id { get; set; }
                public string EmpName { get; set; }
                 public string Reason { get; set; }            
             }
  
       public List&lt;LeaveApplicationDisplay&gt; GetLeaveApplicationDisplayInfo { get; set; }
           [WebMethod]
           public string GetLeaveApplicationDisplay(string id)
           {
               string strhtml = string.Empty;
              try
                {
                   strhtml = GetLeaveApplicationDisplay();
               }
               catch (Exception ex)
             {
  
              }
              return strhtml;
                  }                
     public static string GetLeaveApplicationDisplay() {
     LeaveApplicationDisplay lad = new LeaveApplicationDisplay();
     DataTable table = new DataTable();
    using (SqlConnection con = new SqlConnection(@"server=.;uid=sa;password=password;database=SMS_WORK;")) {
   using (SqlDataAdapter sda = new SqlDataAdapter("SELECT U_Branch,U_empID,U_empName,U_Reason FROM SMS_LEAVE", con)) {
       con.Open();
          sda.Fill(table);
        }}
         DataSet ds = new DataSet();
           ds.Tables.Add(table);                  
        System.Text.StringBuilder HTML = new System.Text.StringBuilder();
         HTML.AppendLine("&lt;table&gt;");
  
         foreach(DataRow dr in ds.Tables[0].Rows){
          HTML.AppendLine("&lt;tr&gt;");
           HTML.AppendFormat("&lt;td&gt;{0}&lt;/td&gt;\n", dr["U_Branch"]);
           HTML.AppendFormat("&lt;td&gt;{0}&lt;/td&gt;\n", dr["U_empID"]);
           HTML.AppendFormat("&lt;td&gt;{0}&lt;/td&gt;\n", dr["U_empName"]);
          HTML.AppendFormat("&lt;td&gt;{0}&lt;/td&gt;\n", dr["U_Reason"]);
         HTML.AppendLine("&lt;/tr&gt;");
           }
          HTML.AppendLine("&lt;/table&gt;");
         return HTML.ToString();                               
       }
  
       leave.html
        __________
  
      &lt;script type="text/javascript" language="javascript"&gt;
         $(document).ready(function () {
          LeaveApplicationDetails();
         });
  
       function LeaveApplicationDetails() {        
          $("#Button1").click(function () {          
        $.ajax({                     
        url: "wservice.asmx/GetLeaveApplicationDisplay",
       contentType: "application/json; charset=utf-8",
         data: "{}",
         dataType: "json",
       type: "POST",
         success: function (Result)
       { $("#displayLeaveInformation").html(Result.d); }
        });
        return false;
       });
        }
       &lt;/script&gt;
        &lt;body&gt;
           ..
        &lt;div id="displayLeaveInformation"&gt;
            ..
       &lt;/body&gt;
  </code></pre>