hi,
i am trying to use checkbox inside the gridview control
i tried with this http://www.aspsnippets.com/Articles/Add-CheckBox-Column-to-DataGridView-in-Windows-Forms-application-using-C-and-VBNet.aspx
refrence all is ok but am getting four Checkbox column inside the gridview
here is my code
private void BindGrid()
{
using (SqlConnection con = new SqlConnection(connectionString))
{
using (SqlCommand cmd = new SqlCommand("select Term from Tbl_TermClass where Class='" + comboClass.Text.ToString() + "'", con))
{
cmd.CommandType = CommandType.Text;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
gridviewterm.DataSource = dt;
gridviewterm.AllowUserToAddRows = false;
}
}
}
}
//Add a CheckBox Column to the DataGridView at the first position.
DataGridViewCheckBoxColumn checkBoxColumn = new DataGridViewCheckBoxColumn();
checkBoxColumn.HeaderText = "";
checkBoxColumn.Width = 30;
checkBoxColumn.Name = "checkBoxColumn";
gridviewterm.Columns.Insert(0, checkBoxColumn);
}
}
}
here is the output image link
https://drive.google.com/open?id=0B5AYIJWtPjpaTnF6M0p6M3dGbDg