In our traditional website construction, it is usually designed to design the website page, then use the development tool to perform functional design within the framework of the website. There are many drawbacks in such a website, and the most prominent disadvantages are not conducive to the group co-developed, and the dependence between each link is too strong.
In ASP.NET, we can use the background encoding to distinguish between HTML user interface (color, aesthetics, etc.) to distinguish between page code. This will solve the parallel development problem of our team.
Its theme idea is: the United States for the design of the website page, the programmer is developed to develop the function division module to be implemented. After the page and function module is developed, we can complete the corresponding functions as long as we change their HTML code slightly in the American worker interface.
Here are a small example to explain.
The function of the programmer has the following modules:
1. Click on the column1 on the left, three contents in the middle show three news
2. Click on Column2, the three contents of the middle show three people
3. Click on Column3 and pop up a window to display a photo.
To test, we can give these three functions to two programmers.
A3: Completion Modules 1 and 2
1. A can build a WebApplication first, put two imageButton: ibtnnews, ibtnmember, and six lab2title, lb2detail, lb2title, lb2detail, on the interface. Generate a web application, click Ibnews, six Label display group news, click IBMEMBER, six Label display group three members. This way we created conditions for the establishment of a source file.
2. We create a C # class file codebehind.cs.
3. Since we are a build web program, you need to add System.Web.dll applications in the Add reference.
4. Remove the constructor because the background encoding does not need to create classes.
5. Let the class inherit the function from the Page object, namely
Public class codebehind: System.Web.ui.page
6. Copy the related code in the WebApplication just generated, there are two parts: declaration partial and method part, here to change the accessibility level protected in the application, because only such an external code can access us Methods and variables should be noted that all controls with the background encoding files on the page must have a corresponding local variable.
7. Generate a codebehind.cs.
At this point, the work of the armor program is completed. The two servers can generate his codebehind.cs file in the same way. Two programmers of A-Part B conduct code synthesis, complete a complete codebehinde.cs;
code show as below:
Using system;
Using system.Web.ui;
Using system.Web.ui.webcontrols;
Namespace Codetest
{
Public class news: system.web.ui.page
{
Public system.web.ui.webcontrols.label lb1title;
Public system.Web.ui.WebControls.label lb1detail;
Public system.web.ui.webcontrols.label lb2title;
Public system.web.ui.webcontrols.label lb2detail; public system.Web.ui.WebControls.label lb3title
Public system.Web.ui.WebControls.Label Lb3detail;
Public system.Web.ui.WebControls.ImageButton Ibtnnews;
Public system.Web.ui.WebControls.ImageButton IibTnmember;
Public system.Web.ui.WebControls.ImageButton IBTNContact;
Public void ibtnnews_click (object sender, system.web.ui.imageClickeventargs e)
{
..............................
}
Public void iibtnmember_click (object sender, system.web.ui.imageClickeventargs e)
{
..............................
}
Public void ibtncontact_click (object sender, system.ui.imageclickeventargs e)
{