We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Validation

the following is my situations:

1. user key in a value in a cell.
2. validating the value and the value is valid.
3. rebind the dataset to GDBC datasource.

when is the good time to rebind the datasource??

i rebind it in the CurrentCellEditingComplete event.. it works fine if i move in the same column with the current cell..
but exception occured when i move to other cell..

The Message box show: "Do dot move current position with this method!"

please help!

6 Replies

AD Administrator Syncfusion Team August 9, 2006 11:59 AM UTC

Hi Ken,

Please try rebinding the grid between the BeginUpdate and EndUpdate() method calls, also call the grid.CurrentCell.EndEdit() and grid.Binder.EndEdit() to save the currentcell before resetting.
Refer the forum thread below,
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=45504

Let us know if this helps.
Thanks,
Rajagopal


AD Administrator Syncfusion Team August 10, 2006 02:54 AM UTC

hi Rajagopal,

Thanks for your quick replied.

The solution you provided is not work for me..
May be i have to make my question clearer.

The following is the requirement:

1. User updating the data in the existing cell:
a. If the data is not valid, rollback the old data.


AD Administrator Syncfusion Team August 10, 2006 03:11 AM UTC

sorry for the posted by accident..


The following is the requirement:

1. User updating the data in the existing cell:
a. If the data is not valid or null, rollback the old data.
b. If the data is valid, rebinding the datagrid with a new datatable.

2. User inserting a new row:

a. If the data is not valid, popup a error messagebox and keep remaining(there is no where can go) in the cell until the new valid data is provided or escape is pressed.
b. if the data is valid, rebinding the datagrid with a new datatable.

Please suggest the best way to meet those requirement..

Thanks!

>hi Rajagopal,

Thanks for your quick replied.

The solution you provided is not work for me..
May be i have to make my question clearer.

The following is the requirement:

1. User updating the data in the existing cell:
a. If the data is not valid, rollback the old data.


AD Administrator Syncfusion Team August 10, 2006 10:34 AM UTC

hi, is my requirement not clear enough?
Please do reply me, i''''ll provide more details.


>sorry for the posted by accident..


The following is the requirement:

1. User updating the data in the existing cell:
a. If the data is not valid or null, rollback the old data.
b. If the data is valid, rebinding the datagrid with a new datatable.

2. User inserting a new row:

a. If the data is not valid, popup a error messagebox and keep remaining(there is no where can go) in the cell until the new valid data is provided or escape is pressed.
b. if the data is valid, rebinding the datagrid with a new datatable.

Please suggest the best way to meet those requirement..

Thanks!

>hi Rajagopal,

Thanks for your quick replied.

The solution you provided is not work for me..
May be i have to make my question clearer.

The following is the requirement:

1. User updating the data in the existing cell:
a. If the data is not valid, rollback the old data.


AD Administrator Syncfusion Team August 10, 2006 12:41 PM UTC

Hi Ken,

You can handle the CurrentCellValidating event of the grid to validate the contents and handle the CurrentCellAcceptedChanges event to rebind the grid with the new datatable.

Please try the attached sample that demonstrates the way you could do this. When you run the sample, try entering some continent names for the string value types(that displays continents in cells), you can notice that grid gets rebinded with new datatable.

Here is the sample
Forum_47622.zip
'>http://www.syncfusion.com/Support/user/uploads/Forum_47622_3e18ed5d.zip">Forum_47622.zip
Let me know if this helps.
Thanks,
Rajagopal


AD Administrator Syncfusion Team August 11, 2006 11:28 AM UTC

hi!

The MessageBox: "Do not move current position with this method" is still there.
The following is my sample code.

void dgOperation_CurrentCellValidating(object sender, CancelEventArgs e)
{
GridCurrentCell cc = dgOperation.CurrentCell;
if (cc.Renderer.ControlText.Trim()== "AAA")
{
e.Cancel = true;
}
}

void dgOperation_CurrentCellAcceptedChanges(object sender, CancelEventArgs e)
{
GridCurrentCell cc = dgOperation.CurrentCell;
cc.Lock();
this.dgOperation.BeginUpdate();
this.dgOperation.Binder.BeginEdit();
this.dgOperation.DataSource = NewDataTable;
this.dgOperation.Binder.EndEdit();
this.dgOperation.EndUpdate();
cc.Unlock();
}


It''s work fine if I leave the currect editing cell by moving to the other cell in the same column.
But the messagebox is popup if i leave the cell by moving to the cell in the other column.

Pls help!

Thanks!!

Loader.
Live Chat Icon For mobile
Up arrow icon