I have a custom edit form made for ASPxGridView but have a big problem retrieving the values when inserting.
The template:
<Templates>
<EditForm>
Company Name: <dx:ASPxTextBox ID="CompanyName" runat="server" />
Company Mail: <dx:ASPxTextBox ID="Email" runat="server" />
<dx:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server" />
<dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server" />
</EditForm>
</Templates>
it fails, the e.NewValues are empty
protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
{
string CompanyName = (string)e.NewValues["CompanyName"]; // (or .toString())
string Email = (string)e.NewValues["Email"];
}
Does anyone know how to solve this?
Thanks
The e.NewValues collection is empty because you did not bind editors to data. To make your code work, it should be changed as follows: