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.

Auto populate fields when adding a new record

Thread ID:

Created:

Updated:

Platform:

Replies:

100909 Sep 13,2011 01:53 PM Sep 15,2011 04:59 AM ASP.NET Web Forms (Classic) 5
loading
Tags: GridGroupingControl
Graham Gardner
Asked On September 13, 2011 01:53 PM

when the user enters the * line on the GridGroupingControl to add a new record I would like to populate some of the fields in the new record from other controls on the form, what would be the best way to do this?


Sridhar N [Syncfusion]
Replied On September 14, 2011 06:17 AM

Hi Graham,

Thanks for your interest in Syncfusion products.

Your requirement can be achieved by handling the CurrentRecordContextChange event and set the record value to be edited. Please refer the below code snippet.

[ASPX]

DataSourceCachingMode="ViewState" TableLayoutMode="Fixed" Width="500" >














[Codebehind - C#]

void GridGroupingControl1_CurrentRecordContextChange(object sender, Syncfusion.Grouping.CurrentRecordContextChangeEventArgs e)
{
if (e.Record != null)
{
if (e.Record.Kind == Syncfusion.Grouping.DisplayElementKind.AddNewRecord && e.Action == Syncfusion.Grouping.CurrentRecordAction.BeginEditComplete)
{
e.Table.AddNewRecord.SetValue("Name", this.TName.Text);
}
}
}


For your convenience, we have created sample and the same can be downloaded from the following link.

GridAddNewDefault1123578910.zip

Please let me know if you have any other questions or concerns.

Regards,
Sridhar.N



Graham Gardner
Replied On September 14, 2011 12:31 PM

Ok it updates the fields ok, and the other fields can be entered ok, however when you press return the new record is not saved to the underlying table?


Graham Gardner
Replied On September 14, 2011 04:55 PM

ok problem resolved, thanks


Graham Gardner
Replied On September 14, 2011 09:06 PM

Actually the saving data issue is still occuring. I have noticed that if I apply a filter via TableDescriptor.RecordFilters and then try to add in a new record via the * line in the grid it is then that the data does not get saved to the table, am I doing something wrong or is there a bug / feature?

e.g. functionality required:

When the page loads I want the grid to filter on todays date, i.e. displays no records. When users select * Line it adds a new entry and when you press return the entry is saved and is then shown in the grid and this is repeated for as many records as required by the user.



Sridhar N [Syncfusion]
Replied On September 15, 2011 04:59 AM

Hi Graham,

Thanks for your update.

We are sorry for inconvenience caused. We suspect that add new is not functioning properly when there is no record in the grid. However, we do not provide confidential information and patches in the general forum, so could you please create a new incident such that after confirming the issue we can fix the issue and provide you the patch.

Please let us know your concerns.

Regards,
Sridhar N


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.

;