Anzeige
10 things to remember
10 things to remember
10 things to remember
10 things to remember
Anzeige
10 things to remember
Nächste SlideShare
Difference between MVC 3, 4, 5 and 6Difference between MVC 3, 4, 5 and 6
Wird geladen in ... 3
1 von 5
Anzeige

Más contenido relacionado

Anzeige
Anzeige

10 things to remember

  1. Developing Web App in Asp.net? Do Remember these 10 things Many developers opt for ASP.NET MVC for their new web applications. But this might not be always possible and you may need to use Web Forms for your new projects. That needs to be followed certain guidelines while developing a Web Forms project then at later stage migrating to MVC would be less painful comparatively. Here we have listed 10 key points to follow: 1. Use Class libraries The evolution of .NET framework over the years depicts that Class Libraries are best for coding that is independent of any particular type of UI. More the code is isolated in class libraries, it would be possible in reusing them during and after the migration which would be quite simple. 2. Use jQuery Ajax over Web Forms specific techniques Web Forms aid AJAX Extensions to help develop Ajax-enabled applications. Though these controls are specific to Web Forms,instead of relying on them you may think of using standard Ajax techniques such as jQuery $ .ajax() or XMLHttpRequest object. Thus Ajax code will be quite portable to any other web
  2. development framework including MVC. 3. Make habit of using Web API Though Web API was introduced along with MVC , now it’s a part of ASP.NET framework and Web API can be used in Web Forms applications too, since Web API controllers will be 100% reusable in MVC applications. 4. Prefer to skip server control level UI properties ASP.NET Web Forms make UI development quite easy. Just drag- n-drop controls set their properties and the UI is ready. One common mistake most developer does is to set UI related properties of the server controls. These properties are transformed into style attribute of the respective control tag. A suggested approach is to place all such information in CSS style sheets and then use Class Name property of the server controls to attach a CSS class. 5. Prefer to skip Web Forms specific features Web Forms use several features that are Web Forms specific, which are not available in MVC. So avoid such features for new projects because it will create difficulty during migration to MVC projects. 6. Create forms without ViewState as much as possible One big reservation which is against Web Forms is ViewState. Many Web Forms designers create their data entry pages in such a way that multiple tasks happen on a single page. This may need
  3. page ViewState enabled resulting in bulky forms. You must see if these tasks can be separated in an attempt to avoid ViewState altogether. 7. Prefer to create reusable UI through User Controls Developers have two choices for developing reusable user interfaces – Web User Controls and Custom Server Controls. If you wrap your reusable UI as a Web User Controls your development will be easy. This is because there is raw HTML and code and MVC offers a close equivalent in the form of partial pages. 8. Develop standard HTML over server controls wherever possible A Rich server control is one of the biggest strength of Web Forms applications. Controls such as GridView and ListView are very popular. But the usage might make your migration complicated due to lack of direct equivalent in MVC. Though it’s not avoidable altogether try to minimize their usage whenever possible. For example, if you don’t need to access Label controls during programming, don’t use them. Use standard <span> or <lable> tags. This way we can reuse that much markup readily in MVC. 9. Understand in terms of MVC even for Web Forms applications Although Web Forms are not created keeping MVC design pattern in mind, but that can’t stop you from thinking in MVC terms. The separation of concern as enforced by MVC can be done in Web Forms also. So when you develop the Web Form try thinking in
  4. terms of its Model, Controller Actions and View. 10. Learn and use Design Patterns and SOLID principles Many of us are habituated to drag-n-drop development. Our applications are UI centric. Though these applications might meet the requirements at a given point of time, they becomes hard to maintain and extend because a lot of code is stuffed directly into Web Forms. Hope you liked the above discussion, let us know your opinion in the comment section below. If you are considering to learn ASP.Net and optimize yourself in .NET training, then our CRB Tech .Net Training center would be very helpful in fulfilling your aspirations. We keep ourself updated with the ongoing generation and that is being portrayed in our ASP.Net course. Stay dropping to this page of CRB Tech reviews for more technical up-gradation and other resources.
Anzeige