In those years, I was also studying asp.net (i) Learning Notes _ Basic Application

Source: Internet
Author: User

Those years to this, basic learning the basic knowledge of the front, those years of the fourth lesson is ASP.net, of course, saw a lot of tutorials, for example, said: "Days to wear, of course, the day to say more, such as object-oriented, C # Knowledge, because at that time on C + +, so did not see these, Start directly from the ASP.net, mainly to learn some of the basic controls asp.net used, and then feel almost no longer read, began to learn the ASP.net data Tutorials (Scott Tutorial), those years slowly toward the web development.

Let's take a look at some of the basic controls in ASP.net.

Use of the GridView control

1. The GridView is a data control in ASP.net, which appears as a table (table) on the page when the data is displayed.

2, the GridView default use Asp:boundfield to bind data, of course, there are other bound controls, while CommandField specified the command

3, the GridView is a template control, Columns under the main TemplateField in the project, editing, paging, head and so on, the template is specified, the template will be displayed in the table cell

Examples such as figure: (Northind database, used below)

Second, the use of FormView control

1, FormView is a template control, when added automatically created a template, you can EditItemTemplate, InsertItemTemplate, ItemTemplate, etc. to set the way data display.

2, FormView only displays a record of data, default is the first, you can enable paging function

3, in the browser display of HTML, in tabular form to display data, you can view the source in the browser Chen Xian

Examples of diagrams are as follows:

Iii. use of DetailsView controls

1, DetailsView each time only display a data, the same enter can edit this data, delete

2, DetailsView on the page display also in the form of a table

3, DetailsView also support the template, you can display the style of design, fields, the field must be finished, will have an effect

Examples of diagrams are as follows:

Iv. Use of LISTVIEWR controls

1, template control, necessary to indicate the ID of the placeholder

2, the page does not appear as a pure template mode

3, does not support paging, can be combined with the implementation of DataPager page

Sample code:

<asp:listview id= "ListView1" runat= "Server" datasourceid= "Listviewdata" itemplaceholderid= "Demo" >< Layouttemplate><asp:placeholder id= "Demo" runat= "Server" ></asp:placeholder><asp:datapager ID= " DataPager1 "runat=" Server "pagesize=" ><fields><asp:nextpreviouspagerfield buttontype= "Link" Showfirstpagebutton= "true" showlastpagebutton= "true"/></fields></asp:datapager></ layouttemplate><itemtemplate><div><% #Eval ("TerritoryID")%></div></itemtemplate ></asp:ListView>

V. Use of Repeater controls

Repeater is a pure template control, developers can display the layout of the data in the way, can be set up the header template, item template, foot template, etc., Rereapter will repeat the read out of the data, there is a lack of page, of course, this is also able to solve, It can be combined with the three-aspnetpager control to achieve pagination, once used in the project; Remember when looking at Scott's tutorial, there was an example of a repeater nesting, and it took a long time to understand. Here is an example of a truncated diagram using it:

This picture and the above is a little, mainly there is no database, so you I understand, hehe.

Six or three-layer structure

Read Scott's tutorial know that the beginning of this tutorial, let us create a data access layer, and then the business logic layer, and finally the performance layer, the next side of the picture, we must have seen:

(Figure cut from Scott Tutorial)

So, take a look at the functions of each layer:

DAL layer: Used to complete access to the database, CRUD operations on the data, the technology used may be ado.net, or some Entity Framework.

BLL layer: Used to complete business requirements and some system requirements, which is also the most complex, because of the constant change in demand, if there is no good code specifications, the change is cumbersome. By reading the data from the DAL layer, the processing is presented to the performance layer and displayed to the user.

GUI layer: Simple is to show the data, if you consider the user experience, this layer is not so good to do, at least the programmer is not good to do, to the art of good.

The advantage of the three-tier structure is that when the database or presentation layer needs to be changed, just need to modify a layer on the line, such as the database from SQL Server to MySQL (or Oracle), then change the data access layer is good; it is also obvious that if the table in the database has been changed to a field, Then each layer will be modified. In addition to the three-layer structure, there are multi-layer structure, more detailed, what the solid layer, AJAX layer and so on.

Summarize

Those years study asp.net read two tutorials and several books (such as: Revealing asp.net3.5), then 4.0, and to understand, finally found in the project, with a more mature technology to complete. This article recalls those years began to learn asp.net days.

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.