Statistics
4
Views
0
Downloads
0
Donations
Support
Share
Uploader

高宏飞

Shared on 2026-06-08

AuthorStewart, Rufus & Bach, John

No description

AI Reading Assistant

Summary and highlights from this book's index; jump to passages in the text

Passage locations
Tags
No tags
Publish Year: 2021
Language: 英文
File Format: PDF
File Size: 421.3 KB
Support Statistics
¥.00 · 0times
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

(This page has no text content)
Introduction Acronym for Active Server Pages They are pages that deal with the server side and are dedicated to building large sites, which are called dynamics as well as small sites alike What are dynamic sites Sites that have a database, send emails and record different data such as company products, bank customers, factory management, and so on all large sites. How this technology works For this to work must be auxiliary factors. For example, man speaks a language .. Also this technique speaks several different languages Like C-Sharp - Visual Basic .NET In the book, the focus is only on C-Sharp because it is the most widely spoken language in the work of more than ninety percent between the world's programmers and programming companies and others. What we are interested in is after the course. I mean to be able to work in free projects or in a company or with programmers. Asp.net technology has an extension ie the page is the last extension or characters are .Aspx
Such as Page1.aspx One of the business requirements is IIS, which prepares your computer to work and make it a local server so you can experience the sites you create on it. It is automatically installed with Visual Studio. Hosting Type Hosting is where you put your site after you make it .. It is of course on the Internet The type of hosting that works with this technique is Windows hosting.
(This page has no text content)
Chapter One Use standard controls This is the first lesson of the "Introduction to ASP.net" series, in which we will try to bring Microsoft's ASP.net platform to beginners, which is detailed into lessons. Each lesson talks about a specific topic. The basic controls built into the ASP.NET platform are essential for creating web applications, where we will learn how to display information using the Label and Literal tools, and how to accept and handle user income through the TextBox, CheckBox, and RadioButton tools. View information The ASP.NET platform supports two tools for displaying text data Label, Literal. While Literal displays data in a simple way, the Label tool offers many additional features and formats. Use the Label control We use the information display tools so that we can modify the text displayed on the page at the time of execution where we can simply select the text to be displayed by assigning the text property of the Label tool, we can also use html formats for this tool to interpret them and generate the desired output, and by default this tool surrounds The text with the tag <span>, in the following code we show different methods of assigning information to the Label tools: ASP.net code
<div> <asp: Label ID = "Label1" runat = "server" Text = "Hi i'm Label1"> </ asp: Label> <br /> <asp: Label ID = "Label2" runat = "server" Text = "Label"> Hi i'm Label2 </ asp: Label> <br /> <asp: Label ID = "Label3" runat = "server" Text = "<b> <i> Hi i'm Label3 </i> </b>"> </ asp: Label> </div> The Label tool supports many text formatting features, including: BackColor: Change the background color of the tool. BorderColor: Sets the color of a frame that surrounds the Label tool. BorderStyle: Specify the window style to display, this property can take one of the following values: NotSet, None, Dotted, Dashed, Solid, Double, Groove, Ridge, Inset, Outset. BorderWidth: Specifies the thickness of the window. CssClass: Specifies the CSS row to be applied to this tool. Font: Specifies the type of font used. ForeColor: Specifies the font color. Style: Applies a specific design to the Label tool. ToolTip: Text that is displayed as a tip when the mouse passes over the Label tool.
The Label tool is usually used to display titles for other tools to help the user do his work, so this tool has the AssociatedControlID property to identify the associated tool and it is generally recommended to use this property. Use the Literal control This tool works very similar to the work of the tool Label, but it does not enclose the text tag <span> This is what we may need in some sites where can not translate html code (such as determining the title of the page on the browser for example), and since this tool does not support the tag <span> It is also Its properties do not support CssClass, BackColor, Literal supports an important feature and is not supported by the Label tool, which is the Mode property, which can take one of the following three values: PassThrough: Interpret the html symbols found in the text and display what they mean. Encode: Displays text without translating html symbols where they appear. Transform: Only symbols supported by the requesting device are interpreted for the page. ASP.net code <div> <asp: Literal ID = "L1" runat = "server" Mode = "PassThrough" Text = "<hr />" /> <asp: Literal ID = "L2" runat = "server" Mode = "Encode" Text = "<hr />" />
<asp: Literal ID = "L3" runat = "server" Mode = "Transform" Text = " <hr />" /> </div> When performing the previous page, Literal1 displays a horizontal line, Literal2 displays the text </hr>, while Literal3 scans the requesting device for the page. If it supports this tag, it displays a horizontal line or the text will be displayed as is </hr>. Accept user income The ASP.NET platform includes tools that allow the user to enter and make choices on the site. It offers three basic tools: TextBox, CheckBox, and RadioButton. Use the TextBox control This tool allows the user to enter text according to three styles determined by the value of the TextMode property: SingleLine: Accept income as only one line. MultiLine: Accept multiple-line access. Password: The user's income appears as icons (stars *** or others). ASP.net code <div> <asp: TextBox ID = "TextBox1" runat = "server" TextMode = "SingleLine" />
<asp: TextBox ID = "TextBox2" runat = "server" TextMode = "MultiLine" /> <asp: TextBox ID = "TextBox3" runat = "server" TextMode = "Password" /> </div> TextBox tool properties: AccessKey: To select a key from the keyboard when pressed, the focus is moved to this tool. AutoCompleteType: Specify an AutoComplete mode where a user needs to enter a few characters in order to show previously entered matching words. This property can be deactivated by assigning the Disabled value to it. AutoPostBack: Send content to the server immediately when any changes in the entered text. Columns: Specifies the number of columns that will appear. Enabled: Activate or deactivate this tool. MaxLength: Specifies the maximum number of characters that can be entered (do not work with MulitLine). ReadOnly: Prevents the user from changing the value in the TextBox. Rows: Specifies the number of lines that will appear. TabIndex: Specifies a number indicating the order of access for this tool via the Tab key. Warp: Specifies whether text can be automatically wrapped with MultiLine mode.
The TextBox control supports the Focus method that allows focus to be placed on execution, and supports the TextChanged event that is fired when the contents of this tool change. To illustrate how the AutoPostBack property works, create a new page, add TextBox1 and set the previous property to True, then add Lable1. What we will do is that when you type text, it will be displayed in the Label1 tool once the focus is moved out of TextBox1. : ASP.net code <div> <asp: TextBox ID = "TextBox1" runat = "server" AutoPostBack = "True" ontextchanged = "TextBox1_TextChanged"> </ asp: TextBox> <asp: Label ID = "Label1" runat = "server" Text = "Label"> <asp: Label> </div> In the TextChanged event of the TextBox1 tool, type the following code: #C code protected void TextBox1_TextChanged (object sender, EventArgs e) { Label1.Text = TextBox1.Text;
} VB code Protected Sub TextBox1_TextChanged (ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Label1.Text = TextBox1.Text End Sub Execute the page, type what you want in TextBox1, press the Tab key on the keyboard and see the result, close the browser and then execute again and type the first letter of the value you entered in the first execution to see how the autocomplete process is done, deactivate the autocomplete feature as shown above Then retry and retype the same word to notice that AutoComplete has stopped. Use the CheckBox control tool This tool allows the user to decide whether to accept or reject an order, ie it is considered as a question to the user and the answer is inevitably either yes or no, e.g. Find out the user option as we'll see shortly. Properties of the CheckBox control: * AccessKey: To select a key from the keyboard when pressed, the focus is moved to this tool. * AutoPostBack: Send the selection option to the server immediately in case of any change.
* Checked: Returns True or False depending on user acceptance or rejection. * Enabled: Activate or deactivate this tool. *TabIndex: Specifies a number indicating the order of access for this tool via the Tab key. *Text: Select the text that appears next to this tool (question asked). * TextAlign: The position of the text for the tool, to its right or left, takes one of the values Left, Right. The CheckBox control supports the Focus method that allows focus to be placed on execution, and it triggers the CheckedChanged event when a user changes their choice whether to reject or accept. A simple example: Create a new page with the tools CheckBox1, Button1, Label1 Click the Button1 button twice and type the following code: #C code protected void Button1_Click (object sender, EventArgs e) { Label1.Text = CheckBox1.Checked.ToString (); } VB code Protected Sub Button1_Click1 (ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = CheckBox1.Checked.ToString () End Sub Execute and select the CheckBox option and then press the button, you will see that the Checked property has returned True, deactivate the option and press the button again. What is the result now? Page code after making minor modifications to the properties as follows: ASP.net code <div> <asp: CheckBox ID = "CheckBox1" runat = "server" Text = "Receive messages on mobile?" TextAlign = "Left" /> <br /> <asp: Button ID = "Button1" runat = "server" Text = "ok" onclick = "Button1_Click" /> <br /> <asp: Label ID = "Label1" runat = "server" Text = "" /> </div> Note: The ASP.Net workstation supports the CheckBoxList tool, which allows you to make a list of its elements, CheckBox tools, as we will see in a later lesson. Use the RadioButton control This tool does not appear individually but is always within a group where the user can select only one option within a group's tools.
RadioButton Control Properties: * AccessKey: To select a key from the keyboard when pressed, the focus is moved to this tool. * AutoPostBack: Send the selection option to the server immediately in case of any change. * Checked: Returns True or False depending on user acceptance or rejection. * Enabled: Activate or deactivate this tool. * GroupName: To join the RadioButton tool into a group, from each group only one option can be selected from the RadionButton tools in it. * TabIndex: Specifies a number indicating the order of access for this tool via the Tab key. * Text: Select the text that appears next to this tool (the option presented). * TextAlign: The position of the text for the tool, to its right or left, takes one of the values Left, Right. The RadioButton control supports the Focus method that allows focus to be placed on execution, and also triggers the CheckedChanged event when the user changes his option. Here's a simple overview of how this tool works, create a new page and add the following tools: RadioButton 3, button, Label, modify the Text property of RadioButton tools so that each tool displays a specific color, and (very important) you should take the previous three tools Same as GroupName, we press the button twice and type the following code: #C code protected void Button1_Click (object sender, EventArgs e)
{ string color = ""; if (RadioButton1.Checked) color = RadioButton1.Text; if (RadioButton2.Checked) color = RadioButton2.Text; if (RadioButton3.Checked) color = RadioButton3.Text; Label1.Text = "Your Favorite color is:" + color; } VB code Protected Sub Button1_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim color As String = "" If RadioButton1.Checked Then color = RadioButton1.Text End If If RadioButton2.Checked Then color = RadioButton2.Text End If If RadioButton3.Checked Then color = RadioButton3.Text End If
Label1.Text = "Your Favorite color is:" + color End Sub The page code is as follows: ASP.net code <div> Favorite color? <br /> <asp: RadioButton ID = "RadioButton1" runat = "server" Text = "Red" GroupName = "colors" /> <br /> <asp: RadioButton ID = "RadioButton2" runat = "server" Text = "Green" GroupName = "colors" /> <br /> <asp: RadioButton ID = "RadioButton3" runat = "server" Text = "Blue" GroupName = "colors" /> <br /> <asp: Button ID = "Button1" runat = "server" Text = "ok" onclick = "Button1_Click" /> <br /> <asp: Label ID = "Label1" runat = "server" Text = "" /> </div> Delete the GroupName property from the previous code and execute and try to choose more than one color.
Note: The ASP.Net platform supports the RadioButtonList tool, which allows you to create a list of its elements, RadioButton tools, as we will see in a later lesson. We have reached the end of the first lesson. In the next lesson, we will discuss how to send form data to the server with various button tools.
(This page has no text content)
Chapter II Submit form data In the previous chapter, we introduced the basic controls that are built into the ASP.NET platform. In this chapter we will learn how to send form data to the server with various button tools. The ASP.Net platform provides us with three tools to send form data to the server: Button, LinkButton and ImageButton. They perform the same functionality but each has its own appearance and features that distinguish it from others. Use the Button control When you click on this tool, it sends the page data to the server to be processed and the code within the Click event of this tool is executed. The following example shows the current time in the Label tool. Twice and type the following code: #C code protected void Button1_Click (object sender, EventArgs e) { Label1.Text = DateTime.Now.ToString ("T"); } VB code
Protected Sub Button1_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = DateTime.Now.ToString ("T") End Sub Full Code Page: ASP.net code <div> <asp: Button ID = "Button1" runat = "server" Text = "Button" onclick = "Button1_Click" /> <br /> <asp: Label ID = "Label1" runat = "server" Text = "" /> </div> Notice that when the button is pressed, the entire page is reloaded, sent to the server, processed and then returned to the user. Button Control Properties AccessKey: To select a key from the keyboard when pressed, the focus is moved to this tool. CommandArgument: Specifies a variable that is sent to the Command event. CommandName: Specifies the name of the command that is sent to the Command event.