Datagrid Questions

  • Thread starter Thread starter pcPirate
  • Start date Start date
P

pcPirate

Hi,

In C#
i) Is there anyway to input value on particular cell in datagrid in the
coding?
ii) How do I save the contents of the datagrid back to database?
iii) I've made a custom datagrid myself, with button on column. However,
what I really want is actually a textbox with button in one column. Is there
any example regarding that?

Pls advise.
Thanks in advance.
pcPirate.
 
Hi,
i) Is there anyway to input value on particular cell in datagrid in the
coding?

You should update the corresponding value in the bound data source instead.
The grid will notice the change and re-paint the cell.
ii) How do I save the contents of the datagrid back to database?

If your data source is a DataTable or a DataSet, you could query it for
GetChanges() and then feed the result of this call to the DataAdapter.
iii) I've made a custom datagrid myself, with button on column. However,
what I really want is actually a textbox with button in one column. Is there
any example regarding that?

If you know how to host a button within a column, you know how to host any
user control within a column. Create a custom user control containing the
textbox and the button and host it instead the button.
 
Back
Top