locked
Validation Error: This property cannot be set to a null value. RRS feed

  • Question

  • User1381821790 posted

    Hi,

    I am facing issues with NOT NULL fields when using Dynamic Data Scaffolding on my website.

    If that particular NOT NULL field is blank in the database, when I try to Edit the row in the Edit page, it always keeps throwing validation error "This property cannot be set to a null value" even when a valid data is entered in the field.

    Can someone please help me on this.

    Friday, March 30, 2012 10:47 AM

Answers

  • User-330204900 posted

    there must be an issue with either your project or DB, try creating a vanila project usign the Nothwind DB (just do a Bing search for it if you don't have it) and then test this is you are still having issues with a known good DB then we can look at the project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 30, 2012 12:17 PM
  • User3866881 posted

    Hello nancy1985:)

    Please try to change the field from NOT Null to Null,and have a try with that;And also plz check your mapping codes……Just like what the MVP's said……When you try to change from Not Null to Null,Make sure that your DateTime also allows Null by setting its as "DateTime?";and then try it again to see what's happened in your real table……

    Reguards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 31, 2012 8:32 PM

All replies

  • User-330204900 posted

    there must be an issue with either your project or DB, try creating a vanila project usign the Nothwind DB (just do a Bing search for it if you don't have it) and then test this is you are still having issues with a known good DB then we can look at the project.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 30, 2012 12:17 PM
  • Friday, March 30, 2012 1:41 PM
  • User3866881 posted

    Hello nancy1985:)

    Please try to change the field from NOT Null to Null,and have a try with that;And also plz check your mapping codes……Just like what the MVP's said……When you try to change from Not Null to Null,Make sure that your DateTime also allows Null by setting its as "DateTime?";and then try it again to see what's happened in your real table……

    Reguards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 31, 2012 8:32 PM