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.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

60956 May 15,2007 11:31 PM May 25,2007 01:56 PM Windows Forms 7
loading
Tags: Grouping
Person
Asked On May 15, 2007 11:31 PM

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 05:45 PM

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 04:42 AM

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 06:37 PM

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 17, 2007 11:07 PM

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 04:35 PM

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 02:41 AM

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 01:56 PM

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.

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.

;