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

How to use ASP.NET to create a page that displays the corresponding welcome information according to the user's input

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to use ASP.NET to create a page that displays the corresponding welcome information according to user input". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use ASP.NET to create a page that displays the corresponding welcome information according to user input.

In this section, we learn to create a page that displays the corresponding welcome information according to the user input. I hope my friends can work with me.

Learning content:

The first step is to create an ASP.NET program

1. Run Visual Studio 2008. In the menu bar, select the "File" → "New →" Project "command, in the pop-up" New Project "dialog box, select the" Visual Studio solution "option in the" other Project types "tree directory on the left, select the" Blank solution "option in the right" Visual Studio installed templates "option area, where the solution is named" 0931 ", and then click" OK ".

2. In the "solution Explorer" window, right-click "solution 0931", select "add" → "New site" command in the pop-up shortcut menu, and then "add New site" dialog box, select "ASP.NET site" option. In the options area at the bottom of the dialog box, select the File system option in the location drop-down list, select the Visual C # option in the language drop-down list: click the Browse button to select the site path: e\ 0931\ Chap1, and click OK.

3. Through the solution Explorer panel on the right side of the Web forms page, you can see the content automatically generated by Visual Studio. Where App-Data is the data folder of the application, Default.aspx is a blank Web forms page, is the default home page of the website, and Default.aspx.cs is the post-file of its code. Move the mouse pointer over the Toolbox tab on the left side of the Web forms page, and you can see the various controls of ASP.NET in the expansion toolbox. When adding controls, just double-click the control or drag the space directly onto the Web forms page.

The second step is the control design of WEB form page.

1, in the Visual Studio 2008 "solution Explorer" panel, right-click the station name Chap1, in the pop-up shortcut menu, select "add New item" command, in the pop-up "add New item" dialog box, select the "Web form" option, named Chap1-1.aspx, by default select "put the code in a separate file" option, click "add" button.

2, switch to the "Design" view, add controls for the Chap1-1.aspx page, and drag 1 Image control, 3 Lable controls, 1 TextBox control, 1 Button control and 1 LinkButton control from the standard group of the toolbox on the left. The first method can right-click the control in Design view, select the Properties command from the pop-up shortcut menu, open the Properties window, and set the properties of the control, such as:

The second method can also add control properties and property values in Source Code view.

The third step, event handling and code post, double-click the Button1 control in the Design view of the Chap1-1.aspx page to automatically add a property and property value for the Button1 control:

OnClick=Button1_Click . Write the code in the Button1_Click event in the Chap1-1.aspx.cs post code file as follows: public partial class chap1_1: system.web.UI.page {protected void page_Load (object sender,EventArgs e) {} protected void Button1_Click (object sender,EventArgs e) {string hello=TextBox1.Text.Trim () + "Welcome, classmate!" ; Lable3.Text=hello;}}

Step 4, WEB.CONFIG configuration file

Finally, click the start debugging button in the standard toolbar to run Chap1-1.aspx. Notice that in the pop-up dialog box, select "run directly without debugging" and click the "OK" button.

Running effect diagram

At this point, I believe you have a deeper understanding of "how to use ASP.NET to create a page that displays the corresponding welcome information according to user input". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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