ASP NET 4 BASICS USING VISUAL STUDIO 2012 Part 4 (More Page Events)
PRE-REQUISITE
Previous tutorial: http://visualstudio-steps.blogspot.com/2014/01/asp-net-4-basics-using-visual-studio_7987.html
Or
Download startup file: https://drive.google.com/file/d/0B86b-ALn-1MGcHBuVEpMU2VKeDQ/edit?usp=sharing 
STEPS
1) Open the Web Site vbsite101.
Open Default.aspx.
2) Edit the <script> by replacing the existing codes for Page_Load with the following codes:
    Sub Page_Init(ByVal s As Object, ByVal e As EventArgs) 
        myTimeLabel.Text = "<br/>1. Page_Init: " + DateTime.Now.ToString() + "<br/>" 
    End Sub 
    Sub Page_Load(ByVal s As Object, ByVal e As EventArgs) 
        myTimeLabel.Text += "2. Page_Load :" + DateTime.Now.ToString() + "<br/>" 
    End Sub 
    Sub Page_PreRender(ByVal s As Object, ByVal e As EventArgs) 
        myTimeLabel.Text += "3. Page_PreRender :" + DateTime.Now.ToString() + "<br/>" 
    End Sub 
    Sub Page_UnLoad(ByVal s As Object, ByVal e As EventArgs) 
        myTimeLabel.Text += "4. Page_UnLoad :" + DateTime.Now.ToString() + "<br/>" 
    End Sub 
 | 
3) Run.
4) Type Hello and click the button.
C# EXERCISE:
void Page_Init(Object s, EventArgs e) 
{ 
   myTimeLabel.Text = "<br/>1. Page_Init:" + DateTime.Now.ToString() +  "<br/>"; 
} 
void Page_Load(Object s, EventArgs e) 
{ 
   myTimeLabel.Text += "2. Page_Load:" + DateTime.Now.ToString() +  "<br/>"; 
} 
   void Page_PreRender(Object s, EventArgs e) 
{ 
   myTimeLabel.Text += "3. Page_PreRender:" + DateTime.Now.ToString() +  "<br/>"; 
} 
void Page_UnLoad(Object s, EventArgs e) 
{ 
   myTimeLabel.Text += "4. Page_UnLoad:" + DateTime.Now.ToString() +  "<br/>"; 
} 
 | 
---
No comments:
Post a Comment