The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
ADAdministrator Syncfusion Team July 11, 2006 05:33 PM UTC
Hi Kai,
Try this code to add a new record in a grid. Here is a code snippet.
DataTable dt = this.gridGroupingControl1.DataSource as DataTable;
this.gridGroupingControl1.BeginUpdate();
DataRow dr = dt.NewRow();
dt.Rows.Add(new object[]{});
dt.AcceptChanges();
this.gridGroupingControl1.EndUpdate(true);
Let me know if this helps.
Best Regards,
Haneef
KAKai AbesserJuly 11, 2006 07:21 PM UTC
Dear Haneef,
i work with typed datasets, i.e.:
this.analyseGrid.BeginUpdate();
dsXLAuftragAnalyseView.XLAuftragMethodeDataTable dt = this.analyseGrid.DataSource as dsXLAuftragAnalyseView.XLAuftragMethodeDataTable;
dsXLAuftragAnalyseView.XLAuftragMethodeRow row = dt.NewXLAuftragMethodeRow();
row.fIsAktiv = true;
...
this.dsXLAuftragAnalyseView.XLAuftragMethode.AddXLAuftragMethodeRow(row);
this.xlAuftragMethodeTableAdapter.Update(this.dsXLAuftragAnalyseView);
this.dsXLAuftragAnalyseView.AcceptChanges();
this.analyseGrid.EndUpdate(true);
but i get an exception, that dt is null.
when i add the row direct in my dataset, anything works, but the grid dosen´t reflect the new record ...
regards
kai
ADAdministrator Syncfusion Team July 11, 2006 09:49 PM UTC
Hi Kai,
Try this code snippet to add a record through grouping table. Please find the code snippet below.
//Form''s Load event
this.gridGroupingControl1.NestedTableGroupOptions.ShowAddNewRecordBeforeDetails = true;
this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = true;
//button''s click event
GridTable table = this.gridGroupingControl1.GetTable("YourTableName");
table.BeginEdit();
Record r = null;
foreach(Element el in table.DisplayElements)
{
if( el.Kind == DisplayElementKind.AddNewRecord )
{
r = el.ParentRecord;
r.SetCurrent();
if( r != null)
{
if (r.IsCurrent)
{
r.BeginEdit();
if (r.IsEditing)
{
r.SetValue("YourColumnName", "BX");
r.SetValue("YourColName", "ID");
r.EndEdit();
}
}
}
break;
}
}
table.EndEdit();
Let me know if this helps.
Best Regards,
Haneef
KAKai AbesserJuly 12, 2006 10:43 AM UTC
Hi Haneef,
intressting way ... thanks it works ...
regards
Kai