Hi,
I try to insert a row from the top as the below InitializeLayout
{
// Add-Row Feature Related Settings
e.Layout.Override.AllowAddNew = AllowAddNew.FixedAddRowOnTop;
e.Layout.Override.TemplateAddRowAppearance.ForeColor = SystemColors.GrayText;
e.Layout.Override.AddRowAppearance.ForeColor = Color.Blue;
e.Layout.Override.TemplateAddRowPrompt = "Enter new Pricing Drug Name here...";
e.Layout.Override.TemplateAddRowPromptAppearance.FontData.Bold = DefaultableBoolean.True;
}
Then I add the AfterRowInsert event to perform another task. When I run the application and click on the row "Enter new Pricing Drug Name here ...", I assumed that it should let me enter something and press the enter key to insert the row first, then the AfterRowInsert event would be fired. However, the AfterRowInsert event fires immediately when I click on the row "Enter new Pricing Drug ...." and not let me enter anything.
Any idea?
Thank you.
AfterRowInsert fires when the AddNew row is created and this occurs when you first change the row.
If you want to trap when the row is committed to the data source, you should use the Before/AfterRowUpdate event. Check the row.IsAddRow property to determine if this is a new row being added or an existing row being edited.
I tried the BeforeRowUpdate event which works well; however, if I set the Cancel flag to true, it clearsall of the data entered by the user (for the row). Is there a way to prevent the row from being added to the underlying dataset and setting Cancel to true, and still have the new row fields remain as-is? This will frustrate the user who must then re-type in all the fields.
Thanks,
It's not really what wanted to do, but i'll give it a try anyway. I think they should have the RowInsert event like the WebGrid for WinGrid.
Thanks