I have this command field in DetailsView.
<asp:CommandField ShowInsertButton="True" CancelText="Reset" />
When user click this link, it inserts the user filled data in DetailsView into database. But I want to set text to two text boxes in this DetailsView before inserting. I can do it in code behind. I have tried this by adding OnItemInserting event to DetailsView. But it's not working. Data set in code behind not inserted to database.
code behind
protected void ABC_DV_ItemInserting(Object sender, DetailsViewInsertEventArgs e)
{
TextBox p = (TextBox)LKArea_DV.FindControl("txt_p");
TextBox x= (TextBox)ABC_DV.FindControl("txt_x");
TextBox y= (TextBox)ABC_DV.FindControl("txt_y");
string[] q = p.Text.Trim().Split(',');
x.Text = q[0];
y.Text = q[1];
}
How could I do this?