TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Member1
NA
169
51k
How do set datagridviewcheckbox as first column at insert?
Nov 14 2015 12:16 AM
I am working on datagridview(dgv), and i am stuck in one issue , i.e I want to display data in dgv by taking some value from combobox(cmb). when i press select button it taking value from cmb and get related data from datatable by executing query . Now my issue comes my datatable has 4 columns (a,b,c,d) and i want to display all in dgv. i dont want to bind table to dgv but i want to add first column as dgvcheckbox and then from 2nd column my datatable columns as (2nd -a, 3rd-b, 4th -c,5th -d) like this at every insertion of rows . when query retrieves rows from table rows count may be anything. so if retrieves 2 rows 2 dgvcheckbox should add at 2 rows i.e 1st column of every row.
Is this possible ? if yes please give me a way thanks !
here is my code for help:
private void button3_Click_1(object sender, EventArgs e) //select button
{
try
{
DateTime date = Convert.ToDateTime(dateTimePicker1.Text);
string stname = comboBox1.SelectedValue.ToString();
string datetime = date.ToString("yyyy-MM-dd 00:00:00.000");
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Proc_GetIndentTable";
cmd.Connection = con;
cmd.Parameters.Add(new SqlParameter("@storename", stname));
cmd.Parameters.Add(new SqlParameter("@date", datetime));
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView3.DataSource = dt;
}
}
Reply
Answers (
1
)
C# Creating Excel Sheet HSSFWorkbook data not populating cor
how to use file upload controls in asp using jquery aja