how to change DataGridViewLinkColumn text property forselected row only ??
-
I have datagridview control and one of its column I hav added DataGridViewLinkColumn. If I click DataGridViewLink of any particular row of datagridview I want to change dynamicaly the Text property of DataGridViewLinkColumn for that Row only. my code is like this //I have set DataGridViewLinkColumn.Text="view" in design property DataGridViewLinkColumn.Text="view" //after clicking the link I want to change the text of link for that row only DataGridViewLinkColumn.CurrentRow.Cells[2].Value="hide" but problem is that text remain unchanged. I dont want "view" ,I want "hide" can any one guide me plz in c# and window application regards tarak
-
I have datagridview control and one of its column I hav added DataGridViewLinkColumn. If I click DataGridViewLink of any particular row of datagridview I want to change dynamicaly the Text property of DataGridViewLinkColumn for that Row only. my code is like this //I have set DataGridViewLinkColumn.Text="view" in design property DataGridViewLinkColumn.Text="view" //after clicking the link I want to change the text of link for that row only DataGridViewLinkColumn.CurrentRow.Cells[2].Value="hide" but problem is that text remain unchanged. I dont want "view" ,I want "hide" can any one guide me plz in c# and window application regards tarak
Try using the Value property of the cell instead of the Text property of the column. Maybe not the best answer, but it produces the behaviour I think you're after. Like so...
private void Form1\_Load(object sender, EventArgs e) { DataGridViewLinkColumn col = new DataGridViewLinkColumn(); dataGridView1.Columns.Add(col); for (int i = 0; i < 4; i++) { DataGridViewRow dr = new DataGridViewRow(); dataGridView1.Rows.Add(dr); } for (int i = 0; i < 4; i++) dataGridView1.Rows\[i\].Cells\[0\].Value = "view"; } private void dataGridView1\_CellClick(object sender, DataGridViewCellEventArgs e) { dataGridView1.Rows\[e.RowIndex\].Cells\[e.ColumnIndex\].Value = "hide"; }