Beginning C# 7 Hands-On:Advanced Language Features
上QQ阅读APP看书,第一时间看更新

Adding a Show Results button to the HTML

Open up a project and, inside the <html>, put in a single button that says Show Results. To do this, go to Toolbox and grab a Button control. Drag and drop it below the line beginning with <form id=.... 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 with the button:

<asp:Button ID="Button1" runat="server" Text="Show Results" /><br />

I'll do a hodgepodge of things just to show you different concepts.

Go to the Design view, and double-click on the Show Results button. This takes us into Default.aspx.cs. Delete the Page_Load block. Your initial code screen for this project should look like Figure 6.1.1:

Figure 6.1.1: The initial Default.aspx.cs code for this project