熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

11.6.1 Wrox United中的配置文件[3]

2013-11-13 12:20:41  來源: .NET編程 

    ()也需要將代碼添加到FanClubaspxvb文件從而btnSaveChanges和btnCancelChanges按鈕將具有事件處理程序在每次單擊這些按鈕時將運行相應的代碼右擊FanClubaspx並且選擇View Code命令然後添加如下突出顯示的方法到FanClubaspxvb文件

 

Partial Class FanClub

    Inherits SystemWebUIPage

 

    Private Sub Page_Load(ByVal sender As Object ByVal e As SystemEventArgs) Handles MeLoad

 

        If Not PageIsPostBack Then

            DisplayProfileProperties()

        End If

    End Sub

 

    Sub btnCancelChanges_Click(ByVal sender As Object ByVal e As SystemEventArgs)

 

        DisplayProfileProperties()

 

    End Sub

 

    Sub btnSaveChanges_Click(ByVal sender As Object ByVal e As SystemEventArgs)

       

        ProfileName = CType(FCLoginViewFindControl(txtName) TextBox)Text

        ProfileAddress = CType(FCLoginViewFindControl(txtAddress) TextBox)Text

        ProfileCity = CType(FCLoginViewFindControl(txtCity) TextBox)Text

        ProfileCounty = CType(FCLoginViewFindControl(txtCounty) TextBox)Text

        ProfilePostCode = CType(FCLoginViewFindControl(txtPostCode) TextBox)Text

        ProfileCountry = CType(FCLoginViewFindControl(txtCountry) TextBox)Text

        ProfileMailings = CType(FCLoginViewFindControl(chkMailing) CheckBox)Checked

        ProfileEmail = CType(FCLoginViewFindControl(txtEmail) TextBox)Text

        ProfileMemberName = CType(FCLoginViewFindControl(txtAlias) TextBox)Text

        ProfileTheme = CType(FCLoginViewFindControl(ThemeList) DropDownList)SelectedValue

        ServerTransfer(SiteMapCurrentNodeUrl)

 

    End Sub

 

    Sub FCLoginView_ViewChanged(ByVal sender As Object ByVal e As SystemEventArgs)

 

        DisplayProfileProperties()

 

    End Sub

 

    Private Sub DisplayProfileProperties()

 

        Dim NameBox As TextBox = CType(FCLoginViewFindControl(txtName) TextBox)

 

        If Not (NameBox Is Nothing) Then

            CType(FCLoginViewFindControl(txtName) TextBox)Text = ProfileName

            CType(FCLoginViewFindControl(txtAddress) TextBox)Text = ProfileAddress

            CType(FCLoginViewFindControl(txtCity) TextBox)Text = ProfileCity

            CType(FCLoginViewFindControl(txtCounty) TextBox)Text = ProfileCounty

            CType(FCLoginViewFindControl(txtPostCode) TextBox)Text = ProfilePostCode

            CType(FCLoginViewFindControl(txtCountry) TextBox)Text = ProfileCountry

            CType(FCLoginViewFindControl(chkMailing) CheckBox)Checked = ProfileMailings

            CType(FCLoginViewFindControl(txtEmail) TextBox)Text = ProfileEmail

            CType(FCLoginViewFindControl(txtAlias) TextBox)Text = ProfileMemberName

            CType(FCLoginViewFindControl(ThemeList) DropDownList)SelectedValue = ProfileTheme

         End If

 

    End Sub

End Class          

    ()再次運行站點並且作為Lou登錄密碼為lou@轉到Fan Club的主頁您將看到頁面底部中的內容

    ()現在輸入一些細節並且單擊Save Changes按鈕如果注銷並且再次登錄將看到己經保存該信息

[]  []  []  []  []  []  


From:http://tw.wingwit.com/Article/program/net/201311/15703.html
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.