Last post Sep 16, 2008 06:53 PM by ricka6
Sep 16, 2008 03:10 AM|Pawel Tarnik|LINK
I've encountered a problem that looks like a bug to me.
1. Create a custom DetailsView that will be used to present existing data and inserting new data
2. Add some required field and mark it as InsertVisible="false"
<asp:DynamicField DataField="SomeRequiredField" InsertVisible="false" />
/* ... other fields ... */
We want that field to be presented to the user when DetailsView is in ReadOnly mode, but we don't want the user to see it in Insert mode - it will be computed on the server side before insert.
3. Try to insert some data using that DetailsView.
Message in ValidationSummary: "The SomeRequiredField field is required".
It turns out that this DynamicField is not rendered in Insert mode, but it's validators are added to the page. So nothing can't be inserted.
It's quite annoying because now I have to make two seperate DetailsView or mark this field in the DB as nullable... :( Any chance to fix it?
Sep 16, 2008 06:53 PM|ricka6|LINK
If you're using EF you can apply
the StoreGeneratedPattern ="Computed"
attribute in the SSDL. L2S uses IsDbGenerated=true
- although you probably don't want to edit your data model.