How to press the link in the datagrid and go to the another form?
Code:
foreach (DataRow item in ds.Tables["timeentryrangedetails"].Rows)
{
DataGridViewLinkColumn link = new DataGridViewLinkColumn();
dataGridView1.Columns.Add(link);
int n = dataGridView1.Rows.Add();
link.Text = "Details";
link.UseColumnTextForLinkValue = true;
dataGridView1.Rows[n].Cells[0].Value = link.Text;
dataGridView1.Rows[n].Cells[1].Value = item["CutoffID"].ToString();
dataGridView1.Rows[n].Cells[2].Value = item["StartDate"].ToString();
dataGridView1.Rows[n].Cells[3].Value = item["EndDate"].ToString();
dataGridView1.Rows[n].Cells[4].Value = item["withTax"].ToString();
dataGridView1.Rows[n].Cells[5].Value = item["SSS"].ToString();
dataGridView1.Rows[n].Cells[6].Value = item["PhilHealth"].ToString();
dataGridView1.Rows[n].Cells[7].Value = item["Pagibig"].ToString();
dataGridView1.Rows[n].Cells[8].Value = item["status"].ToString();
}
you can use the DataGridViewLinkColumn.
For more information read it
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.