bound datagridview new row problem
-
hey guys..i have a bound datagridview in my form and i have two DataGridViewButtonColumn(Edit and Delete)...and the user can add new row..the problem is i want the DataGridViewButtonColumn to be seen as Insert and Cancel instead of Edit and Delete...after inserting process completed it must be seen like other datas..thanks for help
-
hey guys..i have a bound datagridview in my form and i have two DataGridViewButtonColumn(Edit and Delete)...and the user can add new row..the problem is i want the DataGridViewButtonColumn to be seen as Insert and Cancel instead of Edit and Delete...after inserting process completed it must be seen like other datas..thanks for help
erdinc27 wrote:
after inserting process completed it must be seen like other datas
Not exactly sure what you mean by this, but, it sounds like perhaps you should use a TemplateColumn and adjust the button controls as required.
I know the language. I've read a book. - _Madmatt
-
erdinc27 wrote:
after inserting process completed it must be seen like other datas
Not exactly sure what you mean by this, but, it sounds like perhaps you should use a TemplateColumn and adjust the button controls as required.
I know the language. I've read a book. - _Madmatt
hii Mark thanks for reply.. i am searching that u suggested...here the pic what i mean..i mean when i have empty row as in pic the buttons' text must be seen as Add and cancel instead of Update and Delete...and after the user click Add button the row will be added(here no problem) and the button's text must be seen like Update and Delete..like the other buttons..i hope it is more clear now..thanks for help again
-
hii Mark thanks for reply.. i am searching that u suggested...here the pic what i mean..i mean when i have empty row as in pic the buttons' text must be seen as Add and cancel instead of Update and Delete...and after the user click Add button the row will be added(here no problem) and the button's text must be seen like Update and Delete..like the other buttons..i hope it is more clear now..thanks for help again
Handle the RowDataBound or RowCreated event and update the button text appropriately.
I know the language. I've read a book. - _Madmatt
-
Handle the RowDataBound or RowCreated event and update the button text appropriately.
I know the language. I've read a book. - _Madmatt
i couldnt find both events that u suggested...i have UserAddedRows and RowsAdded..i tried both
private void datagridview1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
{
datagridview1.CurrentRow.Cells[6].Value = "Insert";
}i cant catch Text Property here..that is why i used Value property but it gives error like "Object reference not set to an instance of an object." so what else i can try ?
-
i couldnt find both events that u suggested...i have UserAddedRows and RowsAdded..i tried both
private void datagridview1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
{
datagridview1.CurrentRow.Cells[6].Value = "Insert";
}i cant catch Text Property here..that is why i used Value property but it gives error like "Object reference not set to an instance of an object." so what else i can try ?
hi again.. thanks for help and your time..i solved my problem like below.in my button's click event that i create new row
int rowCount = datagridview1.Rows.Count;
DataGridViewButtonCell buttonCell = (DataGridViewButtonCell)datagridview1.Rows[rowCount].Cells[6];
buttonCell.UseColumnTextForButtonValue = false;
buttonCell.Value = "Insert";