- Home
- Forum
- ASP.NET Web Forms (Classic)
- Auto populate fields when adding a new record
Auto populate fields when adding a new record
- Sep 13, 2011 05:53 PM UTC
- Sep 15, 2011 08:59 AM UTC
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?
SIGN IN To post a reply.
5 Replies
SN
Sridhar N
Syncfusion Team
September 14, 2011 10:17 AM UTC
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]
[Codebehind - C#]
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
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
GG
Graham Gardner
September 14, 2011 04:31 PM UTC
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?
GG
Graham Gardner
September 14, 2011 08:55 PM UTC
ok problem resolved, thanks
GG
Graham Gardner
September 15, 2011 01:06 AM UTC
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.
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.
SN
Sridhar N
Syncfusion Team
September 15, 2011 08:59 AM UTC
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
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
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
GG Graham Gardner
- Sep 13, 2011 05:53 PM UTC
- Sep 15, 2011 08:59 AM UTC