本文整理匯總了VB.NET中System.Web.UI.UserControl.Session屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET UserControl.Session屬性的具體用法?VB.NET UserControl.Session怎麽用?VB.NET UserControl.Session使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Web.UI.UserControl
的用法示例。
在下文中一共展示了UserControl.Session屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: SubmitBtn_Click
' Saves state information which is used by display handler after the postback has occurred.
Sub SubmitBtn_Click(Sender As Object, e As EventArgs)
' Clear all values from session state of 'Page'.
Session.Clear()
' Populate Session State of UserControl with the values entered by user.
myControl.Session.Add("username",myControl.user.Text)
myControl.Session.Add("password",myControl.password.Text)
' Add UserControl state to the SessionState object of Page.
Session(myControl.user.Text)= myControl
Display.Enabled = true
End Sub
Sub Display_Click(Sender As Object,e As EventArgs)
Dim position As Integer = Session.Count - 1
' Extract stored UserControl from the session state of page.
Dim tempControl As LogOnControl = CType(Session(Session.Keys(position)),LogOnControl)
' Use SessionState of UserControl to display previously typed information.
txtSession.Text = "<br /><br />User:" + tempControl.Session("username") + "<br />Password : " + tempControl.Session("password")
Display.Enabled = false
End Sub