Page 217 - DCAP408_WEB_PROGRAMMING
P. 217
Unit 8: ASP Web Forms
28: } Notes
29: }
30: }
31:
32: void OnConvert(Object Sender, EventArgs e)
33: {
34: Single fFeet = Single.Parse(Feet.Text);
35: Single fInches = Single.Parse(Inches.Text);
36: Double fMeters = 0.305*fFeet + 0.0254*fInches;
37: lblMeters.Text = “<b>You are “ + fMeters.ToString() + “ meters tall</b>”;
38: }
39: </script>
Let’s examine how Web forms work using above Listing as our reference. Web forms like
Listing 1 are processed in two different ways:
A Web form is rendered when the user initially browses to the .aspx file. In this case, the
Web form doesn’t process any events because there has been no user interaction.
A Web form may be processed after the user interacts with one of the page controls. For
instance, the user might click a button on the page or select an item from a drop-down list.
When the user does so, the same Web form gets hit by the user’s browser, this time with
information about what the user has done.
Through both cases, a Web form goes through five distinct stages when it’s rendered, as shown
in Figure 8.3.
Figure 8.3: Web forms Processing Stages
LOVELY PROFESSIONAL UNIVERSITY 211