1
Answer

how to set Checkbox in HTML table grid?

sudharsan s

sudharsan s

12y
1.7k
1

Hi..


I am using HTML table grid .

I want to set check box in first column of grid.

i am using the append method to fetch the data from database

here is my code..

public void load_builder()
{
    SqlConnection con = new SqlConnection(constring);
    con.Open();
    string sql = "select category_code,category,created_date from category";
    SqlCommand cmd = new SqlCommand(sql, con);
    SqlDataReader dr;
    dr = cmd.ExecuteReader();
    //sb.Append("<tbody>");
    while (dr.Read())
    {
       
        sb.Append("<tr >");
        sb.Append("<td onclick=\"loaddata('" + dr[0].ToString() + "')\">select</td>");
        sb.Append("<td id='c1" + dr[0].ToString() + "'>" + dr[0].ToString() + "</td>");
        sb.Append("<td id='c2" + dr[0].ToString() + "'>" + dr[1].ToString() + "</td>");
        sb.Append("<td id='c3" + dr[0].ToString() + "'>" + dr[2].ToString() + "</td>");
        sb.Append("</tr>");
    }
}

Instead of select  i want to set checkbox.


pls help me..


Advanx thx..


Sudharsan S.

Answers (1)