Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The function of ASP.NET Framework and the example Analysis of the Application of ASP.NET MVC pattern

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you the functions of the ASP.NET framework and the example analysis of the application of the ASP.NET MVC pattern, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

The function of ASP.NET framework, compatible with MVC

The Web forms that it may appear have very different technologies from MVC. However, these two technologies are based on the ASP.NET framework. As a result, most of the ASP.NET framework features that you have for creating applications that are all based on Web can also be provided to you as a developing country for MVC applications. This includes features such as membership, authentication, roles and configuration, which work in MVC applications in the same way as they do in Web forms applications. Most ASP.NET namespaces, classes, and interfaces can be used in ASP.NET MVC schema applications.

The function of ASP.NET framework, MVC that does not conform to

Since ASP.NET 's MVC does not retain state information by using view state, you have to find other ways to manage state information if you need it. In addition, server controls rely on view state and pass-through will not work properly to design applications in ASP.NET MVC mode. Therefore, you should not use controls such as GridView, repeater and DataList controls.

/ / A Student class: publicclassStudent {publicintNumber {get;set;} publicstringName {get;set;}} / / the binding data constructed by DummyData is as follows: Liststudents=newList (); students.Add (newStudent {Name= "lee", Number=123}); students.Add (newStudent {Name= "Zen", Number=234}); students.Add (newStudent {Name= "angle", Number=101}); ViewData ["Students"] = students

The problem with using Repeater in View is actually the execution of binding events.

We design a base class of View, which completes the DataBind when the page Load, so that no matter whether there are controls in the page that need to be bound or what controls need to be bound, the binding will be completed after the execution of this method. First of all, test our ideas:

/ / View base class publicclassAutoBindViewPage:ViewPage {protectedoverridevoidOnLoad (EventArgse) {this.DataBind (); base.OnLoad (e);}}

Page code snippet:

Helloworld

RepeaterTest

Name:

The above is a sample analysis of the functions of the ASP.NET framework and the application of the ASP.NET MVC pattern. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report