datagridview value
i have a list of values in datagridview. i want to show the selected row values from one datagridview into another datagridview....
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Feb 16, 2011, 2:48 AM
junaid sarfrazPosted Feb 14, 2011, 7:11 AM
Amit ChoudharyPosted Feb 14, 2011, 7:06 AM
use int RowID= e.RowIndex;
instead of RowId = GridView1.CurrentRow.Index;
Rest code is good to go..
Madhu KPosted Feb 14, 2011, 6:44 AM
This dirty code will give you an idea
//cell click event to
private void GridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
RowId = GridView1.CurrentRow.Index;
DataTable dt = new DataTable();
DataColumn dc = new DataColumn("id");
DataColumn dc1 = new DataColumn("name");
DataRow dr = dt.NewRow();
dt.Columns.Add(dc); dt.Columns.Add(dc1);
dr["CSID"] = CSGridView1.Rows[RowId].Cells[0].Value;
dr1["Name"] = CSGridView1.Rows[RowId].Cells[1].Value; //
dt.Rows.Add(dr);
dataGridView1.DataSource = dt;
}
ShankeyPosted Feb 14, 2011, 4:21 AM
http://social.msdn.microsoft.com/Forums/en/winforms/thread/9d9bf88e-ec2f-4e5d-ad44-a65de705fe16
http://weblogs.asp.net/hpreishuber/archive/2005/08/05/421712.aspx