locked
DynamicField + InsertVisible bug? RRS feed

  • Question

  • User1202816037 posted

    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"

        <Fields>

            <asp:DynamicField DataField="SomeRequiredField" InsertVisible="false" />

            /* ... other fields ... */

        </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.

     

    Problem:

    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?

    Tuesday, September 16, 2008 3:10 AM

Answers

  • User-1005219520 posted

    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.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 16, 2008 6:53 PM