Creation of the C#web website

Source: Internet
Author: User

The difference between CS and BS

CS Software: The software needs to be installed on the client.

BS software: A Web site is a BS software that can only be run with a browser.

To create a process:

1. File New---New site----Blank site

2. Right-click the Web site project---Add Web page (Web form)

The resulting file

Right-click--Publish--to first folder

Ii. simple knowledge of Web sites

The page we see in the Web site is an aspx file in the VS Developer Tool: An ASPX-terminated file that is actually made up of two parts. Part of the interface, part of the CS code.

ASPX page controls:

1. Server controls

Are some of the controls that. NET provides to us, which are the same as the controls in WinForm, are made up of classes, and then drag a control to the interface, which is equivalent to creating an object.

When we go through the browser to browse this page,. NET automatically resolves these server controls into HTML tags.

This parsing process is called serialization.

2. Client-side controls

Refers to HTML tags.

Three, simple operation

1. Add a server control event:

Drag a button in the design window to add a click event, just as you do when you develop a WinForm program.

Automatically add a line of source code

Double-click the button to append a function

Run the results, click the button

2. Add a client control event.

<input type="Button"Name="Button2"Id="btn2"onclick="Change ()"Value="Add"/><script>function Change () {varX=document.getelementbyid ("Div1"); X.innerhtml="Zhang San"; }    </script>

Run the results, click the button "add"

3. Change the client control to a server control

Add a runat property, and then change the original "onclick" to "OnServerClick", you can append the function of the server control

Run, click "Add"

The relationship between the control and the event:

The server control can go directly to the background time, and the OnClick trigger is the background event. OnClientClick trigger JS event;

Client control, if you want to become a server control, you need to add runat= "Server", and the OnClick trigger is JS, on the basis of the addition of runat= "Server", using onserverclick= "".

Iv. configuration File Settings

Set Debug to True, run slowly, an exception occurs, and. NET helps us navigate to the location of the exception.

Set debug to False, run fast, have an exception, and display errors directly in the browser.

Creation of the C#web website

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.