tags:

views:

67

answers:

1

All,

I have a customized DataGridView where I have implemented extra functionality and bounded datasource in the same custom DataGridView (Using C# and .NET). Now, I could able to use it properly by placing it on a panel control. I have added label as button on panel control to display data from datasource on to datagrid and create a binding source. Another Label which act as a button is used to update data from grid to databse.

Issue: I pressed show label to display data in a dsatagridview. Modified the grid cell value and immediately pressed update label which is on same panel control. I observed that, the cursor is still in the grid cell when I press Save button. While saving, the cell value is null even though I have entered something in the presentation layer. My expected behaviour is to get the modified value while saving.

Special Case: After typing something in the grid cell, if I click on somewhere else like the row below where I entered something, before I click on Save button, it is working fine. (Here, mainly I tried to remove the focus from the currently modified cell)

Is there any way to bind sources before I click on save button? Please suggest me.

Please feel free to ask me if you need any information.

I have also seen same kind of problem on this forum, but unfortunately the author got the answer and didnt post it back.

here is that URL:

http://social.msdn.microsoft.com/Forums/en/winformsdesigner/thread/54dcc87a-adc2-4965-b306-9aa9e79c2946

Please help me.

A: 

are you using a DB for the values of the datagrid? if so. just query it back after saving the data and restore the values of the datagrid but set the datagrid to null first before setting its value

Treby