Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have a couple of options but the best way would be to create a method on the user control that wraps the text property of your label and allows users to pass in a value that you in turn assign to the label's <code>Text</code> property. </p> <p>Then create another method on your Master Page that accepts a string parameter and passes that value through to the method on your user control. Then you can call this method on your Master Page from your web form.</p> <p>So on your user control add a method like this:</p> <pre><code>Public Sub SetDisplayText(ByVal displayText As String) SomeLabel.Text = displayText End Sub </code></pre> <p>then add a method to your Master Page like this:</p> <pre><code>Public Sub SetDisplayText(ByVal displayText As String) SomeUserControl.SetDisplayText(displayText) End Sub </code></pre> <p>Now your web form can call the <code>SetDisplayText</code> method on the Master Page to set the text on the user control's label:</p> <pre><code>Dim masterPage As SomeMasterPage = TryCast(Me.Master, SomeMasterPage) If masterPage IsNot Nothing Then masterPage.SetDisplayText("foo") End If </code></pre> <p>This may feel like overkill but this kind of abstraction is necessary to reduce coupling between your components. This approach also gives you a lot of flexibility moving forward as changes can be made without affecting other components. For instance, if you rename your label control you will not need to go change the web form that sets its text value as the web form won't know (or care) what the label is called, only how to set its display value.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload