Hi Aaron, I guess the field isn't nullable and the DetailsView or/and LLBLGenProDataSource2 is sending the value as NULL which isn't a valid value.
Shouldn't a field which has data deleted from it save as en empty string?
Yes if you want. For that you should:
1. Tell LLBLGenProDataSource2 that "empty strings" should be treated as "empty strings", not NULL values (Ref: LLBLGenPro Help -> Using the generated code -> Adapter -> Databinding at designtime and runtime -> Databinding with APS.NET 2.0 -> Converting empty string values ("") to NULL values for inserts/updates):
yourLLBLGenProDataSource.AllFieldsKeepEmptyStringAsValue = true;
or per field basis:
// in your Page Load handler routine
if( !Page.IsPostBack )
{
List<string> fieldsWhichShouldKeepEmptyString = new List<string>();
fieldsWhichShouldKeepEmptyString.Add( "ShipAddress" );
_ordersDS.FieldNamesKeepEmptyStringAsValue = fieldsWhichShouldKeepEmptyString;
}
**2. **The grid/detailsView has for every field a property (click on 'Edit fields' in the smarttag of the grid): ConvertEmptyStringToNull. THis is by default set to true. This means that an empty value is send to the datasourcecontrol as null, not as empty string. So the datasourcecontrol receives a null, which means it can't accept it as the field isn't nullable. If you set the property ConvertEmptyStringToNull to false for a textfield which should accept "", an empty textbox will send a "" to the datasourcecontrol, which is then accepted as a value (Ref...).