Summary
This chapter has seen us dabble with
ASP.NET code for the first time. While some of the examples might have seemed
quite repetitive, it is necessary to be comfortable with how you go about
handling all the different HTML server controls, as they will crop up
frequently and we won't spend any time going back over how they work.
We introduced
the ASP.NET server controls in preference to using the HTML form controls, and
demonstrated that the server-side counterparts of many of the HTML form
controls offer extra functionality over their client-side counterparts. In
particular, we saw how we could use the <asp:label> control to display text and how we could use the
other controls such as <asp:dropdownlist>, <asp:textbox>, and <asp:radiobutton> in place of HTML form controls.
In our next
chapter, we will look at how we can store information within our ASP.NET pages,
using variables.
Exercises
1. Explain the difference between an HTML form and a web form.
2.
Explain the difference between <form> and <form runat="server"> and describe how each one is handled.
3.
Personalize the following birthday
message to the President by adding your own name and unique gift within the <script>...</script> blocks. You may want to save and run this code first to see what
you're aiming for:
<script
language="C#" runat="server">
Â
</script>
<html>
<body>
 <h1>Happy Birthday</h1>
 <br /><br />
 <h1>Mr. President!!</h1>
<br /><br />
 I,
 <asp:label id="Message1" runat="server"
text="Joe Bloggs,"/>
   wish you many happy returns. Enjoy the
 <asp:label id="Message2" runat="server"
text="candy!"/>
</body>
</html>
4. Modify the example you just created to give the President a list of
three birthday present choices to choose from. Use the <asp:checkbox> control to do this. Include a Submit button so the President knows which presents he has chosen.
Buy Beginning ASP.NET with C# here
© Copyright 2002 Wrox Press
This chapter is written by David Sussman, et al
and taken from "Beginning ASP.NET with C#" published by Wrox Press Limited in June 2002; ISBN 1861007345; copyright © Wrox Press Limited 2002; all rights reserved.
No part of these chapters may be reproduced, stored in a retrieval system or transmitted in any form or by any means -- electronic, electrostatic, mechanical, photocopying, recording or otherwise -- without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews.
|
|