2011-01-26 9 views

答えて

1

ページからアクセスできるパブリックプロパティをユーザーコントロールに定義します。 (あなたのascxファイルで)例えば

Public Property Text() As String 
    Get 
     Return Me.TextBox1.Text 
    End Get 
    Set(ByVal value As String) 
      Me.TextBox1.Text = value 
    End Set 
End Property 

とあなたのDefault.aspxで

Dim myUserControlsText as String = MyUserControl.Text 

あなたが可能性:

MyUserControl.Text = "this is the text that should be in my usercontrol's textbox" 

と同じ値を取得しますあなたのページのテキストdirectly from the aspx-markupも設定してください。

<uc1:MyUserControl id="MyUserControl1" Text="this is the text that should be in my usercontrol's textbox" runat="server" /> 
関連する問題