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.
Unfortunately, activation email could not send to your email. Please try again.

Validation

Thread ID:

Created:

Updated:

Platform:

Replies:

47622 Aug 9,2006 06:08 AM Aug 11,2006 07:28 AM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 9, 2006 06:08 AM

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!

Administrator [Syncfusion]
Replied On August 9, 2006 07:59 AM

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

Administrator [Syncfusion]
Replied On August 9, 2006 10:54 PM

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.

Administrator [Syncfusion]
Replied On August 9, 2006 11:11 PM

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.

Administrator [Syncfusion]
Replied On August 10, 2006 06:34 AM

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.

Administrator [Syncfusion]
Replied On August 10, 2006 08:41 AM

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

Administrator [Syncfusion]
Replied On August 11, 2006 07:28 AM

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!!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;