ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing

ExpertRating Home
ExpertRating Benefits
Recommend ExpertRating
Suggest More Tests
Privacy Policy
FAQ
Login
 
ASP Dot Net Tutorial - Index
ASP Dot Net Tutorial - Microsofts ASP.NET
ASP Dot Net Tutorial - Begining Web Forms
ASP Dot Net Tutorial - User Controls
ASP Dot Net Tutorial - ADO .NET
ASP Dot Net Tutorial - DataBinding to WebControls
ASP Dot Net Tutorial - DataList Controls
ASP Dot Net Tutorial - DataGrid Control
ASP Dot Net Tutorial - Advance Practical Examples on DataGrid
ASP Dot Net Tutorial - Working with DataSets
ASP Dot Net Tutorial - Working with XML
ASP Dot Net Tutorial - Forms Based Authentication
ASP Dot Net Tutorial - Windows Based Authentication
     

 
Online Personal Trainer Certification
Personal Trainer Certification (Spanish)
Six Sigma Certification
Find a Personal Trainer
Project Management Certification
Six Sigma Certification
Six Sigma Black Belt Certification
Master Black Belt Certification
Six Sigma Green Belt Certification
Life Coach Certification
Lean Management Certification
Lean Six Sigma Certification
First Aid Certification
CPR Certification
Yoga Certification
Aerobics Certification
Pilates Certification
Business Analyst Certification
SEO Certification
Online Business Writing Course & Certification
Makeup Artist Certification
Baby Sitting Course & Certification
Time Management Certification
Health Club Management Certification
Medical Coding Certification
Medical Billing Certification
Business Analysis Course
Master Trainer Certification
Total Quality Management Certification
Kaizen Certification
Creative Writing Certification
Event Management Certification
Test Search by Job Title
Administrative Assistant Certification
Virtual Assistant Certification
  All Online Courses
   

   
   
   
   
   
   

   
  Home > Courses, Tutorials & eBooks > ASP.NET Tutorial > Microsoft's ASP.Net
 
Next

ASP.NET Tutorial - Microsoft's ASP.NET

 
                                                                                                               Page 5 of 6
 

Usefulness of View State

One situation in which view state is important is form validation.

Suppose a user registration form is created with several required form fields i.e. you do not want anyone to submit the form without entering the first and the last name. If by chance someone has submitted the user registration form without completing the required form fields. In such a situation, you would like to display an appropriate error message. Further, you would like to re-display all the form information that the user had already entered, as no user would like to start from the scratch again.

Therefore View State automatically preserves the form information that the user enters.

Structure of an ASP.NET Page

Let us examine the main elements of a typical ASP.NET page. The following are the important parts of an ASP.NET page:

  • Directives
  • Code declaration block
  • Code render block
  • ASP.NET controls
  • Server side comments
  • Server side include directives

To explain the above elements let us take an example given below:

Example5:Message.aspx

<%@ Page Language="VB" %>

<script runat="server">

Sub Message_Change(Sender as Object, E as EventArgs)

lblMessage.Text="Hello " + txtMessage.Text

End Sub

</script>

<html>

<body>

<font size="5">ASP.NET Home Page</font>

<hr><p><font size="4">

<% Response.Write("This is ASP.NET Page")%><p>

</font>

<form runat="server">

enter Your Name:

<asp:textbox id="txtMessage" runat="server"/><p>

<asp:button id="btSubmit" OnClick="Message_Change"

text="Submit" runat="server"/><p>

<b>

<asp:label id="lblMessage" runat="server"/>

</b>

<%--

this is inside the comments

<asp:label text="hello" runat="server"/>

<%= strSomeText %>

--%>

</form>

</body>

</html>

 

Save this page in your root directory and view it on the browser, the output is shown below. Enter your name in the textbox and click the submit button. You will see a nice hello message.

Common elements of an ASP.NET page.

       

 

 

 
     
Home  |  About Us  |  Privacy Policy  |  Site Map  |  FAQs  |  Contact Us
 
© ExpertRating 2015. All Rights Reserved.