13.07.2015 Views

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

112<strong>ASP</strong>.<strong>NET</strong> <strong>3.5</strong>: A Beginner’s <strong>Guide</strong>Figure 5-2 Assigned values can be sharedAs you can see, the script simply transfers the value of the input text form to the textarea.Both forms use the value attribute, and C# is able to use those HTML form elements toplace the contents of one form into another as you can see in Figure 5-2.Try ThisObviously, transferring data from a text input form to a textarea form isn’t too usefulunless the user has a chance to enter data. Therefore, we need to look at using somethingto hold the transfer until it is ready to be used.HTML ButtonsNow that you’ve seen that C# can pass values between HTML forms, let’s take a look atHTML buttons. The bad news is that HTML buttons do not automatically generate theC# code for event handling. With Standard buttons, all you have to do is to switch to theDesign mode and double-click on the button to generate the C# event handler. However,when you double-click an HTML button, you get JavaScript code instead.Using HTML ButtonsThe following steps give you a quick view of what happens when you use an HTML buttonrather than a Standard button from the Toolbox.1. Open a new Web Site by selecting File | New | Web Site. Give it the name junk becauseyou’ll be throwing it out when you’re done.2. In the Source mode, drag an Input (Button) from the Toolbox to the container(between the and tags).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!