Web Development Basics

Creating a Web Form that submits to itself, postback, is a common Web development technique. When you configure your Web Forms to postback, you will need a placeholder for displaying information when the page comes back to the user. You can put an empty SPAN tag into your Web Form as a placeholder for displaying results back to the user.

With ASP.NET Web Forms, you can either have your server-side code imbedded in the Web Form, extension is .aspx, or place the code in a code-behind page, in the case of C# the extension is .cs. The concept of code-behind pages is a new feature that was not available in ASP 3.0. Code-behind pages enable you to separate code from presentation (HTML). This is a cleaner programming model that is closer to what is available to event-driven programming tools that programmers have had for years.

GenericTemplate.aspH - Notepad

GenericTemplate.aspH - Notepad

Click File O Save As.

m Type Comments.aspx a your filename.

■ The Web page appears with the form on it.

Click File O Save As.

Click to select the Default Web Site folder where you want to store your file.

-■ If the Default Web Site folder is not onscreen, click the Save in 0 to select the folder.

m Type Comments.aspx a your filename.

Click Save to save and close the dialog box.

le Browse to the saved Web page at http://localhost /Comments.aspx.

Note: See page 20 for instructions on browsing the default Web site.

■ The Web page appears with the form on it.

Note: If you click the Send Comments button on this form, nothing significant should happen because no code has been created for when the page submits the form to itself.

Was this article helpful?

0 0

Post a comment