Imports System.Drawing
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls


Public Class events_II
    Inherits System.Web.UI.Page
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents span1 As System.Web.UI.HtmlControls.HtmlGenericControl
    Protected WithEvents textbox1 As System.Web.UI.HtmlControls.HtmlInputText
    Protected WithEvents button1 As System.Web.UI.HtmlControls.HtmlInputButton
    
#Region " Web Forms Designer Generated Code "
    
    'CODEGEN: This procedure is required by the Web Form Designer
    'Do not modify it using the code editor.
    Private Sub InitializeComponent()

    End Sub

#End Region

    Protected Sub Page_Init(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' -- write out that the page loaded
        Response().Write("<BR>the page was loaded")

        ' -- set the veiwstate here
        Page().EnableViewState = True

        'write out the viewstate condition to the browser
        If Page().EnableViewState = False Then
            Response().Write("<BR>enableviewstate is false")
        End If

        If Page().IsPostBack Then
            ' -- the page was posted
            Response().Write("<BR>the page was posted")
            Dim msg As String
            msg = "The following text: <i><font color=red>" & textbox1().Value & "</font></i> was entered in the textbox"
            span1().InnerHtml = msg

        Else
            Label1().Text = "With ViewState On, the text in this label will get posted back and preserved."
        End If


    End Sub

    Private Sub button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.ServerClick
        Response().Write("<BR>the button was clicked")

    End Sub

    Private Sub events_II_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
        'textbox1().Value = "Betty Rubble"
    End Sub
End Class
