How to Bind Records to Html table

Jayakumars
Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 1667


private void HtmlCode()
{
con.Open();
str = "select * from employee";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "employee");
dt = ds.Tables["employee"];

sb.Append("<table><tr><td> Name List</td></tr>");

for (int i = 0; i < dt.Rows.Count - 1; i++)
{
//sb.Append("<table><tr><td> Name: " + ds.Tables[0].DefaultView[i][1].ToString() + "</td></tr></table>");
sb.Append("<tr><td> " + ds.Tables[0].DefaultView[i][1].ToString() + " </td></tr></table");
}
lblnewmessage.Text = sb.ToString();
}

Comments or Responses

Login to post response