Ok, I found solution. DetailsView
and FormView
in OnItemUpdating
event compares previous and new values and if these are changed, update it. When I put null into e.NewValues
, while my TextBox
is not bounded by Bound
function, e.OldValues["EntityFrameworkEntityPropertyName"]
doesn't exists (means null) and in NewValues
is null also, so column is not updated.
I simply set e.OldValues["EntityFrameworkEntityPropertyName"]
to anything (but same type) and now inserting nulls works fine.
protected void FormView_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
e.OldValues["EntityFrameworkEntityPropertyName"] = -1
e.NewValues["EntityFrameworkEntityPropertyName"] = null;
}
My textbox is not bounded directly, because I need to process its value before I will show it up to user. On insert/update I need also some value processing.