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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cannot select other cells after e.Cancel=true is called.

Thread ID:

Created:

Updated:

Platform:

Replies:

60956 May 16,2007 03:31 AM UTC May 25,2007 05:56 PM UTC WinForms 7
loading
Tags: Grouping
Person
Asked On May 16, 2007 03:31 AM UTC

Hi,

Since I don't want to have new row added automatically, I called "e.Cancel=true" for EndEditCalled Action in CurrentRecordContextChange(). But after I do this, other cells cannot be selected except the cell in current record.

I tried calling method CurrentCell.Deactivate(), CurrentCell.EndEdit() and CurrentRecord.EndEdit(), but it results in a looping.. the cause may be because of EndEditCalled action is triggered for these methods.

Any idea for how can other cell be selected after e.Cancel=true is called for EndEditCalled action?

Thanks!

Rajagopal [Syncfusion]
Replied On May 16, 2007 09:45 PM UTC

Hi Person,

If you dont want to have add new records in grid, use the below property settings.

this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = false;

Let us know if this is not what you needed.
Regards,
Rajagopal

Person
Replied On May 17, 2007 08:42 AM UTC

Hi Rajagopal,

Thanks for reply.
That's not what I want. What I need to solve is if a cell is edited, no matter pressing Enter key or mouse click on anywhere, a new row will be added in the grid.

I search in forum and find the way to use CurrentRecordContextChange event and set e.Cancel=true, then no more new row is added. However, apart from the editing row field, no other rows and their cell can be selected.

Could you help on this.

Thanks again.

Rajagopal [Syncfusion]
Replied On May 17, 2007 10:37 PM UTC

Hi Person,

Please try the modified code below in the CurrentRecordContextChange event of the grid.

void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if (e.Action == CurrentRecordAction.EndEditCalled)
{
e.Cancel = true;
e.Record.GetRecord().CancelEdit();
}
}

Let us know if this helps.
Regards,
Rajagopal

Person
Replied On May 18, 2007 03:07 AM UTC

Hi Rajagopal,

I am sorry to tell that the way you provided is just discarding the changes on the cell as well as a new row is added to the grid again.

Actually, is it possible to turn off the new line adding? It seems that a new line will be automatically added to the grid after any editing on the cell record.

Thanks again.

haneefm [Syncfusion]
Replied On May 18, 2007 08:35 PM UTC

Hi Person,

Try checking the addnewrow in a CurrentRecordContextChange event and set e.Cancel to true for EndEditCalled action. Below is a code snippet.

private void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if (e.Record is GridAddNewRecord && e.Action == CurrentRecordAction.EndEditCalled)
{
e.Cancel = true;
e.Record.GetRecord().CancelEdit();
}
}

Best regards,
Haneef

Person
Replied On May 25, 2007 06:41 AM UTC

Hi Haneef,

Thanks for reply.
Your suggestion will result in a new row added.
(i.e. I add a new row, and edit a cell in that row, after edit finish and clicking on other cell, the editing row is fine, but.. another new row is added in the grid which I don't want..)

Do you have any idea on this?


haneefm [Syncfusion]
Replied On May 25, 2007 05:56 PM UTC

Hi Person,

Thank you for your update.

Is it possible for you to upload us a minimal sample to reproduce the issue here? This will help us to analyse the issue further.

Best regards,
Haneef

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.

Warning Icon 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.Close Icon

;