Web Studyaspnet.blogspot.com Babyneed.blogspot.com

ASP.Net Web Developer Guide

Power By: eXTReMe Tracker Powered by Blogger  
 
 
 
 

 

 
Important Links
 
   
     
 
Sitemap
 
   
   
 
Reference
 
   

Sunday, March 05, 2006

A Simple Application Using Conventional HTML Controls(Chapter3)

As shown in Figure 3.5, we will display some flower names using conventional HTML controls. On click of a command button we will request the same form from the server.The code for this form is shown in Figure 3.6.

Figure 3.5 Conventional HTML Form and Controls


Figure 3.6 A Simple .aspx File Using Conventional HTML Controls
(Conventiona1.aspx)
<!— Chapter3\Conventional1.aspx —>
<html><head</head>
<form action="htmlListbox.aspx" method="post">
<body>Select a flower and then either click on the
submit button or refresh the page.
You will see that your selection has been lost
in successive requests of the page. <br/><br/>
<select name="lstFlowers" size="3">
<option value="Tulip">Tulip</option>
<option value="Poppy">Poppy</option>
<option value="Iris">Iris</option>
</select> <br/><br/>
<input type="submit" value="Submit"/>
</body></form></html>

Once the form is displayed, we will select a flower from the list box, and either click on the Submit button or refresh the page. In both cases, the system will return the same form, but we will see that our selection has been lost.This is due to the state-less nature of HTTP protocol. On each request, the server serves the requested page, however, it does not remember the values of the controls assigned in its prior invocation. In ASP days, we had to include a good amount of codes to preserve the states of the controls.Well,ASP.NET has made life easier! It preserves the states of controls automatically.

0 Comments:

Post a Comment

<< Home