GGC new row default values
Hi there,
in GGC control, I want to set default values for some columns when a new row is added.
do you have a new-row-added event in GGC so that I can add code there to populate columns' default values? what is the best way to do that?
Thank you in advance.
Lan
in GGC control, I want to set default values for some columns when a new row is added.
do you have a new-row-added event in GGC so that I can add code there to populate columns' default values? what is the best way to do that?
Thank you in advance.
Lan
SIGN IN To post a reply.
3 Replies
NA
Nisha Arockiya A
Syncfusion Team
January 15, 2009 12:47 PM UTC
Hi Lan,
Thanks for your interest in Syncfusion Products.
The GridGroupingControl has options to have the addnew row in top and at the bottom. If you want to have this only at the bottom, add the below property settings.
Thanks for your interest in Syncfusion Products.
The GridGroupingControl has options to have the addnew row in top and at the bottom. If you want to have this only at the bottom, add the below property settings.
this.GridGroupingControl1.TableDescriptor.AllowNew = true;
this.GridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
this.GridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = true;
To add a new row programmatically in grid, you need to add a new row to the underlying datasource bound to the grid. The Grid just displays the rows from the bounded datasource.
Please try the below code. The below code gets the value for the first two columns from current record in grid and sets some default value to other columns for the new row added.
try
{
Record rec = this.gridGroupingControl1.Table.CurrentRecord;
if (rec != null)
{
object[] obj = new object[] { rec.GetValue("Col0"), rec.GetValue("Col1"), "someval", "someval", "someval" };
CurrencyManager cm = (CurrencyManager)(this.gridGroupingControl1.BindingContext[this.gridGroupingControl1.DataSource, this.gridGroupingControl1.DataMember]);
DataView dv = (DataView)cm.List;
dv.Table.Rows.Add(obj);
this.gridGroupingControl1.Engine.ResetTable();
}
}
catch (Exception ex)
{
throw ex;
}
Please let me know if this serve your needs.
Regards,
Nisha.
JO
Jose
January 30, 2009 01:43 PM UTC
The code:
" DataView dv = (DataView)cm.List;"
fails because I'm using Linq.
How can I add code there to populate columns default values if I use Linq ?
" DataView dv = (DataView)cm.List;"
fails because I'm using Linq.
How can I add code there to populate columns default values if I use Linq ?
NA
Nisha Arockiya A
Syncfusion Team
February 5, 2009 01:15 PM UTC
Hi Jose,
Thanks for the Update.
Please refer to the following sample.
\My Documents\Syncfusion\EssentialStudio\6.3.0.24\Windows\Grid.Grouping.Windows\Samples\2.0\FeaturedSamples\LINQGroupBy
Let me know if you find any difficultied.
Regards,
Nisha.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
LM Lan Mo
- Jan 14, 2009 03:25 PM UTC
- Feb 5, 2009 01:15 PM UTC