Create the first ASP. NET application (section 1st), asp.net section 1st

Source: Internet
Author: User

Create the first ASP. NET application (section 1st), asp.net section 1st

In this section, we will learn how to create a page that displays the corresponding welcome information based on user input. We hope that our friends can work with me.
Learning content:
Step 1: Create an ASP. NET program
1. Run Visual Studio 2008. On the menu bar, select "file"> "new"> "project". In the displayed "Create Project" dialog box, select the "Visual Studio solution" option in the "other project types" tree on the left, and select the "blank solution" option in the "templates installed in Visual Studio" option area on the right, name the solution "0931" and click "OK ".
2. In the Solution Explorer window, right-click solution 0931 and choose add> New website from the shortcut menu, in the "Add new website" dialog box, select "ASP.. NET website option. In the option area at the bottom of the dialog box, select the File System option from the location drop-down list, select the "Visual C #" option in the "language" drop-down list: click "Browse" to select the site path: E \ 0931 \ Chap1, and click "OK ".
3. You can view the content automatically generated by Visual Studio on the "solution Resource Manager" Panel on the right of the Web forms page. App-Data is the Data folder of the application, and Default. aspx is a blank Web form page, which is the Default homepage of the website and Default. aspx. cs is the Post File of its code. Move the mouse pointer to the "toolbox" tab on the left side of the Web form page. ASP is displayed in the expanded toolbox. when adding controls, you only need to double-click the controls or drag the space directly to the Web form page.

Step 2: WEB form page Control Design
1. on the "solution Resource Manager" Panel of Visual Studio 2008, right-click the site name Chap1 and select the "Add new project" command in the pop-up shortcut menu, in the add new items dialog box that appears, select the Web forms option named Chap1-1.aspx, select the place code in a separate file option by default, and click the Add button.
2. Switch to the design view, add controls to the Chap1-1.aspx page, drag one Image control, three Lable controls, one TextBox Control from the left toolbox standard group, one Button control and one LinkButton control.Method 1You can right-click the control in the design view and select the "properties" command from the shortcut menu to open the "properties" window. Set the properties of the control, for example:

Method 2You can also add control attributes and attribute values in the "source code" view.
Step 3: event processing and code Postfix, Double-click the Button1 control in the design view on the Chap1-1.aspx page to automatically add a property and property value to the Button1 control:

OnClick = button#click. Write the following code in the Button1_Click event of the Chap1-1.aspx.cs post code file: public partial class chap1_1: system. web. UI. page {protected void page_Load (object sender, EventArgs e) {} protected void button#click (object sender, EventArgs e) {string hello = TextBox1.Text. trim () + "Thank you! "; Lable3.Text = hello ;}}

Step 4: WEB. CONFIG configuration file
Finally, click Start debugging in the Standard toolbar to run the Chap1-1.aspx. Note: In the displayed dialog box, select "run without debugging" and click "OK.

Run

Summary
Today, xiaobian created the first ASP. NET Applications, although there are a lot of imperfections, the layout is not fine enough, beautiful; there are also errors in the operation process, repeated operations, when opening the page, the picture cannot be opened normally, found that the reason isThe image path is not specified correctly,However, through this course, I learned a lot of skills and started the amazing journey of ASP. NET.

I hope you can explore and learn together with xiaobian.

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.