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.
Syncfusion Feedback

RecordAdded property in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

89769 Sep 5,2009 10:23 AM UTC Sep 14,2009 07:05 AM UTC Windows Forms 5
loading
Tags: GridControl
Santosh U
Asked On September 5, 2009 10:23 AM UTC

Hi,

Where is the event for RecordAdded ??

There is RecordDeleted, RecordExpanded etc. but could not see RecordAdded.


Actually my main requirement is that when a record is added the cursor is moved to the added record. I wan to set cursor back to the AddNewRecord record.

Regards,
Santosh U

Rajadurai C [Syncfusion]
Replied On September 9, 2009 10:50 AM UTC

Hi Santosh,

Thanks for your interest in Syncfusion Products.

If a new record is added through AddNewRecord in grid, the focus moves to the new record. It is the general behavior followed in grid. If you would like to set the focus to the AddNewRecord itself even the record must be added to grid, it cannot be achieved easily by simply cancelling the event. One thing you can do is, if you are allowing the users to interact only with the addnewrecord, then the following simple workaround can help in achieving this.
//CurrentRecordContextChange event

void gridGroupingControl1_CurrentRecordContextChange(object sender, Syncfusion.Grouping.CurrentRecordContextChangeEventArgs e)
{
if (e.Action == Syncfusion.Grouping.CurrentRecordAction.EndEditComplete)
{
if (e.Record.Kind == Syncfusion.Grouping.DisplayElementKind.AddNewRecord)
{
this.gridGroupingControl1.Table.CurrentRecord = this.gridGroupingControl1.Table.AddNewRecord;
this.gridGroupingControl1.Table.CurrentRecord.BeginEdit();
}
}
}

This doesn't allow the focus to move out of addnewrecord once the focus is set even the new records keep adding.

Regards,
Rajadurai

Santosh U
Replied On September 10, 2009 02:44 PM UTC

Hi Rajadurai,

This is working perfect, Can i also set focus to the fist column of grid since the columns which are at the end depend data on the first columns.

Thanks,
Santosh U

Rajadurai C [Syncfusion]
Replied On September 11, 2009 10:10 AM UTC

Hi Santosh,

Thanks for your update.

If you would like to set the focus to the first column in addnewrecord each time new record is added, then set current cell focus to the first cell in addnewrecord and activate it in CurrentRecordContextChange event. Here is the modified code for your reference.

CurrentRecordContextChange event

void gridGroupingControl1_CurrentRecordContextChange(object sender, Syncfusion.Grouping.CurrentRecordContextChangeEventArgs e)
{
if (e.Action == Syncfusion.Grouping.CurrentRecordAction.EndEditComplete)
{
if (e.Record.Kind == Syncfusion.Grouping.DisplayElementKind.AddNewRecord)
{
this.gridGroupingControl1.Table.CurrentRecord = this.gridGroupingControl1.Table.AddNewRecord;
e.Record.GetRecord().BeginEdit();
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(e.Record.GetRowIndex(), 1);
this.gridGroupingControl1.TableControl.CurrentCell.Activate(e.Record.GetRowIndex(), 1);
this.gridGroupingControl1.TableControl.CurrentCell.BeginEdit();
}
}
}


Regards,
Rajadurai

Santosh U
Replied On September 11, 2009 03:00 PM UTC

Hi Rajadurai,

I used this and it worked well also but there is another problem happened due to this. This is the same grid as I have posted in other thread (populating data on DropDownGridShowing).
Once the focus is set on the first row I am not able to see the dropdown once I click on the button :(

Please help.
Thanks,
Santosh

Rajadurai C [Syncfusion]
Replied On September 14, 2009 07:05 AM UTC

Hi Santosh,

Thanks for your update.

Please refer to the following sample in which the workaround provided for addnewrecord is implemented along with the sample 'GGCAddNewRowTest'. When the new record has focus, the dropdown of the other columns of the new record can be viewed by clicking on dropdownbutton.
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F89769.zip

With this workaround, the focus cannot be moved from the AddNewRecord to other records as requested before.

Let me know if you have any further concerns.

Regards,
Rajadurai

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

;