Hello,
I am Working on Windows Form Telerik.
As I have Grid View of Telerik Control and i want to add New Entry into that.
I have Button for create new Entry Click on that button Winform will popup and on that popup if i click on save it will add that row.
But My Problem is that 1 Row added with that another Row also add which is not required.
My Code Is Below.
public void Save(TimesheetEntry timesheetEntry)
{
if (timesheetEntry.TimesheetEntriesId == -1)
{
timesheetEntry.SequenceNumber = GetNextSequenceNumber(timesheetEntry.FileId, timesheetEntry.EntryDate);
Add(timesheetEntry);
}
else
{
Update(timesheetEntry);
}
}
private TimesheetEntry Add(TimesheetEntry item)
{
_context.TimesheetEntries.AddObject(item);
_context.SaveChanges();
return item;
}
And On Edit Button also it will Generate 2 rows.
which code is as below.
private TimesheetEntry Update(TimesheetEntry item)
{
_context.TimesheetEntries.ApplyChanges(item);
_context.ObjectStateManager.ChangeObjectState(item, System.Data.EntityState.Modified);
_context.SaveChanges(true);
return item;
}
plz help me to resolve this issue.
Thanks