locked
Validation in ASP.Net MVC RRS feed

  • Question

  • I have used model validation in my application also i have used razor rendering engine. When i used to insert values from my form it doesnt validate?? also i have a table in my database also i have a column name "code" in my database which is of type varchar. I have to insert unique code for every department then how to validate it? also tips for server validation. please do help me out.
    • Moved by Mike Danes Friday, February 8, 2013 7:25 AM ASP.NET related
    Friday, February 8, 2013 7:09 AM

Answers

All replies

  • ASP.NET related questions should be asked in the ASP.NET forums:  http://forums.asp.net

    • Proposed as answer by Just Karl Monday, September 8, 2014 8:00 PM
    • Marked as answer by Just Karl Tuesday, September 9, 2014 3:38 PM
    Friday, February 8, 2013 7:14 AM
  • Hi,

    Do you have any fix pattern to generate the unique key? If its a straight incremental number the I would suggest you should modify the design of the table and change it to integer and change the Identity specification as Yes in SQL server. or else you should write a separate validation method at server side to validate and generate the next unique custom code it can not be achieved by the MVC out of box validation.

    Thanks and Regards

    Murtuza

    Monday, September 8, 2014 4:01 AM

  • I would be helpful if you could share some code that causing validation issue also you can use "Guid.NewGuid()" to have unique value.

    Thanks & regards, Asma Khalid web: www.asmak9.com

    Monday, July 24, 2017 8:01 AM