Saving the state of the application - for example , if you put into a textbox that corresponds to an int the value "aaa", "aaa" should be persisted somewhere.
Another thing you can do with ModelState is check the validity of the model. If there are any validation errors, they will be added to the ModelState and ModelState.IsValid will be set to false. For it's useful for validation also.
pavankumarmc...
Member
7 Points
97 Posts
Use of ModelState
May 02, 2012 09:55 AM|LINK
Hi all
Can any one tell me, what is the exact use of ModelState class.
I saw it in some blogs during logon app creation in MVC 3..
ignatandrei
All-Star
134822 Points
21599 Posts
Moderator
MVP
Re: Use of ModelState
May 02, 2012 10:50 AM|LINK
Saving the state of the application - for example , if you put into a textbox that corresponds to an int the value "aaa", "aaa" should be persisted somewhere.
pavankumarmc...
Member
7 Points
97 Posts
Re: Use of ModelState
May 02, 2012 11:13 AM|LINK
Hi ignatandrei,
I got your point and thanks for reply...
CodeHobo
All-Star
18647 Points
2647 Posts
Re: Use of ModelState
May 02, 2012 04:16 PM|LINK
Another thing you can do with ModelState is check the validity of the model. If there are any validation errors, they will be added to the ModelState and ModelState.IsValid will be set to false. For it's useful for validation also.
Blog | Twitter : @Hattan