Re: [.NET] web user control彼此傳值
這是我練習時寫的
利用 Property Get & Set 取得 & 設定 UserControl 的屬性
n
以下範例:
一個 Label、一個 TextBox、一個 Button、一個 Calendar
使用的 Web Form 取值可用:Date_Selector1.SelectedDateValue
Partial Class Date_Selector
Inherits System.Web.UI.UserControl
Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
TextBox1.Text = Calendar1.SelectedDate
Calendar1.Visible = False
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Calendar1.Visible = True
End Sub
Public ReadOnly Property SelectedDateValue() As String
Get
Return TextBox1.Text
End Get
End Property
Public Property Date_SelectorTitle() As String
Get
Return Label1.Text
End Get
Set(ByVal value As String)
Label1.Text = value
End Set
End Property
End Class
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.231.77.199
※ 編輯: mathlinka 來自: 61.231.77.199 (03/09 22:00)
討論串 (同標題文章)
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章