官术网_书友最值得收藏!

Adding a box and a Find Max button to the HTML

Bring up a project, and we will set up a box, read three values from this box, and then find the maximum value. We'll also do some other things such as learning how to convert from an array of one data type to another.

Let's begin by typing Enter Values: under the line beginning with <form id=...:

Then, go to Toolbox, grab a Textbox control, and put that after Enter Values:. You can delete the <div> lines as you don't need them. Be sure to insert a <br> tag at the end of the line:

Enter Values:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />

In the next stage, you'll insert a Button control; so get one from the Toolbox and drop it below this line. Change the text on the button to say Find Max. Again, end the line with a <br> tag:

<asp:Button ID="Button1" runat="server" Text="Find Max" /><br />

Your HTML file for this project should look like Figure 7.2.1:

Figure 7.2.1: The HTML file for this project

Now go to the Design view. All that we now have is a box and a button, as shown in Figure 7.2.2:

Figure 7.2.2: Our simple interface in the Design view

Next, double-click on the Find Max button to go to the Default.aspx.cs file, and delete everything. The code in this chapter will be somewhat sophisticated and perhaps a little more challenging than that of previous chapters, but it's the best way to grow and move forward. I will go through the construction of the code line by line. By now, you should be able to see what it takes to begin to program well and how much you have to know.

主站蜘蛛池模板: 桦甸市| 明溪县| 杨浦区| 孝义市| 五华县| 武山县| 汶上县| 新乐市| 滁州市| 麻城市| 榆中县| 五台县| 新巴尔虎右旗| 西乌| 河间市| 桓仁| 丹凤县| 正阳县| 巨野县| 盘锦市| 慈溪市| 澄城县| 交城县| 得荣县| 晋江市| 博乐市| 蓝山县| 临沭县| 康保县| 武城县| 萝北县| 梁河县| 清河县| 高安市| 乐业县| 竹北市| 大城县| 大同市| 五大连池市| 台东县| 集贤县|