I recently answered a question that came up on the StackOverflow website. The question was whether using the ViewBag dynamic property of the controller to expose the error message was a good practice, as the OP investigations suggested that it was necessary to expose properties from the model.
Obviously it is highly recommended NOT to use the ViewBag property since it does not provide any Strong Typing. If you want to communicate with the view you should always involve a typed model. The suggested solution is therefore legitimate in that respect, however, it is not a good practice when it comes to model error handling in ASP.NET MVC.
The solution for exposing error messages (as in the previous example, which does not use data annotation attributes) derives from the use of the AddModelError method, from the ModelStateDictionary class. We do not need to instantiate this class because a ModelState property containing an instance of this class already exists in the Controller.
Therefore, the right solution is the following:...
Read more
Microsoft offers a wide range of online certification programs designed to help you grow your skills and your career. This article will focus on developer certifications....
Read more
Microsoft offre une large gamme de programmes de certification conçus pour t'aider à développer tes compétences et ta carrière. Cet article se concentrera sur les certifications de développeurs....
Read more
I started programming when I was in high school. I learned a few lessons over the past decade, and I thought I would take a moment to gather my thoughts on these things. It took me about ten years and a lot of experimentation to figure out some of this....
Read more
J'ai commencé la programmation quand j'étais au lycée. J'ai appris quelques leçons au cours de la dernière décennie, et je me suis dit que je prendrais un moment pour recueillir mes réflexions sur ces sujets. Il m'a fallu environ dix ans et beaucoup d'expérimentation pour assimiler certaines de ces choses....
Read more
If you don't know what Xamarin is, may I suggest that you start by reading my introductory notes before proceeding with this ? For those in the now, let's get into it without further ado....
Read more
Si tu ne sais pas ce qu'est Xamarin, puis-je te suggérer de commencer par lire mon article d'introduction avant de continuer avec celui-ci?
Pour ceux qui savent, entrons dans le vif du sujet....
Read more
Just Keep Moving Forward....
Read more
Le rêve à temps plus que partiel, le travail à temps carrément complet....
Read more
Xamarin is a cross-platform development tool. It solves dilemmas many developers face when developing cross-platform apps: separate coding languages and UI paradigms. With Xamarin, you can use C# for iOS, Android, and Universal Windows apps. And with Xamarin Forms, interface design for all three platforms can be accomplished within its XAML-based framework. Here is some documentation I would recommend if you consider getting started with Xamarin....
Read more