JayBee wrote:
I have some of it working using the suggestions on http://www.kowitz.net/archive/2007/11/08/idataerrorinfo-for-asp.net.aspx
This solutions dynamically adds custom validators to the page for each error found. And for each property that is invalid it inserts a literal in the page that should result in a red coloured asterisk (*) being shown next to the property. The errors added via the custom validators are shown in a validation summary.
I have a gridview showing products. When a product is selected, stock details are shown in a detailsview. The user can choose the edit icon in the detailsview. When he does, enters wrong input and chooses to save, the input is not accepted.
The validation summary works, but the asterisks are not displayed. Also the information shown in the detailsview is refreshed by the content of the database and the detailsview returns back into readonly mode (the default).
I would like the detailsview to stay in edit-mode and the content not being refreshed, allowing the user to correct the input.
I'm willing to post what I have got until now, but I'm reluctant because I think this is not a LLBLGen problem, but a result of ASP.NET functionality.
Hi,
I'm not a user of LLBLGen, although I do have similar problems with ASP.NET and validation.
The behavior you are seeing from the details view and can be fixed via an event :
protected void DetailsViewAddress_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
e.KeepInInsertMode = true;
}
If you with to do something based on valid data being inserted, use an event from the datasource (this is from ObjectDataSource, but I'm sure LLBLGen has something similar):
void ObjectDataSourceAddress_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
{
/* ... hide DetailsView... */
}
In general if you are using a data source I'd treat details view as a 'dumb' interface, the datasource is the component with the power. Hope this helps.