Some common solutions to conflicts between asp.net development and web standards

Source: Internet
Author: User

In the forum, new users who are engaged in. net development often ask some questions about conflicts with web standards during asp.net development. In fact, it is actually a question about client code generation. I can't tell you more about development. I would like to share my suggestions with you from the perspective of the front-end of the page:

Less server-side controls in asp.net

In Visual Studio, there are a series of powerful controls that make it easy for our start-up. net developers. However, most of the controls in vs are migrated based on the winForm mode. In web development, it is better to use fewer controls, such:

  • Do not always add form runat = "server". Some friends say that many other controls cannot be used without form runat = "server. Yes, we just need to add it where necessary. There is indeed a form. Naturally, we need to add it, but it is definitely not. net by default, all pages are under the body tag. The first tag is form. This is unreasonable.
  • If you do not use controls such as Asp: Gridview, consider the asp: Repeater control or write a third-party control by yourself. It is very simple to let the code output listen to your control.
  • Asp: Label is replaced with asp: Literal, and asp: Literal output is clean.
  • Use less controls such as asp: LinkButton. links are links and buttons are buttons. There is no need to create a LinkButton ......
  • Although the default form verification control is easy to use, it is easy to write by yourself.
  • In short, we should pay attention to the quality of code output, and some default controls do not meet this requirement.

Use less Frameset/Iframe labels

In general, the use of frame pages for layout (Header/Sidebar/Content/Footer) on webpages has basically been eliminated. Of course, applications such as background management can still be used, the page displayed on the front end cannot be used. MasterPage is available at the beginning of Visual Studio 2005, which is also very convenient to use. In fact, it is similar to include header. asp in early asp.

Use less PostBack Mechanism

The postback mechanism in. net has a reason to use it properly. It's right to use less Internet products!

More mature. net open-source products

For example, Microsoft's open-source oXite, PetShop, Discuz Forum. net, BlogEngine, and CVBBS are all good examples developed based on. net.

Focus more on client code Quality

After all, it is browser-based, user experience, W3C standards, browser compatibility, and so on. Without good client code, it is not supported.

Learn more about the necessary client

Many. net beginners do not know enough about the basic knowledge of html, css, and javascript clients, especially javascript. You will find that many of the things you have done before are Postback to the server, it was easy to use javascript on the client! Web development is the foundation!

I saw oXite a few days ago and installed asp.net MVC Beat. I am not. net fans, but I did not pay attention to it. Today I have created a new MvcApplication sample project to get a general understanding of it and see the highlights I want to see:

  • Code Generation is very clean, which is very important.
  • Do not use the existing postback model that returns interaction to the server. That is to say, there is no viewstate or page lifecycle in the MVC-based view.
  • It includes a very powerful URL ing component that allows you to use very clean URLs to build applications.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.