2

I got this ASPxGridView which is populated by a LinqServerModeDataSource.

What I want to do is when creating a new row one (or more) of the fields should have their values generated by code-behind.

I figured something like

protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
{
    e.NewValues["CompanyGuid"] = Guid.NewGuid();
}

But no luck there. Any advices?

Thanks enter image description here

Eric Herlitz
  • 25,354
  • 27
  • 113
  • 157

1 Answers1

3

Figured it out

I'd have to add a reference to oninitnewrow="ASPxGridView1_InitNewRow" in the control and add the method

protected void ASPxGridView1_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
{
    e.NewValues["CompanyGuid"] = Guid.NewGuid();
}
Eric Herlitz
  • 25,354
  • 27
  • 113
  • 157