How Do I: Send Text to a control in my User Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles

    How Do I: Send Text to a control in my User Control

    Hello,
    I am in ASP.NET using C#.
    I have a user control called "progHeader.asc x" that has
    a label control call "pageTitle" . How do I
    call "pageTitle" from my asp page(Inventory. aspx), with
    the usercontrol "progheader " dropped on to it, and send
    the current page title to "pageTitle" ?
    Charles
  • Jeffrey Tan[MSFT]

    #2
    RE: How Do I: Send Text to a control in my User Control


    Hi Charles,

    Thank you for posting in this group.
    Is your user control created by yourself or by others?

    If it is created by yourself, you can create the label as the public
    reference of user control class.
    Then you can manipulate the label in the control like this:
    WebCustomContro l11.Label1.Text ="abc";

    Also(And more reasonable), you can create a public property for the label
    and you can manipulate it through the property.

    If the control is not created by yourself and it does not expose any
    property or public reference field for the label, it means that the creator
    of the usercontrol does not want you to manipulate it, this label is for
    some internal usage of this user control.

    Hope this helps,

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

    --------------------
    | Content-Class: urn:content-classes:message
    | From: "Charles" <CWildner@bells outh.net>
    | Sender: "Charles" <CWildner@bells outh.net>
    | Subject: How Do I: Send Text to a control in my User Control
    | Date: Fri, 3 Oct 2003 16:59:29 -0700
    | Lines: 8
    | Message-ID: <1f97a01c38a0a$ 620cfbf0$a60128 0a@phx.gbl>
    | MIME-Version: 1.0
    | Content-Type: text/plain;
    | charset="iso-8859-1"
    | Content-Transfer-Encoding: 7bit
    | X-Newsreader: Microsoft CDO for Windows 2000
    | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    | Thread-Index: AcOKCmIMy3y+hnz qR1Kn6CzbkEBKIA ==
    | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
    | Path: cpmsftngxa06.ph x.gbl
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1888 82
    | NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
    | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
    |
    | Hello,
    | I am in ASP.NET using C#.
    | I have a user control called "progHeader.asc x" that has
    | a label control call "pageTitle" . How do I
    | call "pageTitle" from my asp page(Inventory. aspx), with
    | the usercontrol "progheader " dropped on to it, and send
    | the current page title to "pageTitle" ?
    | Charles
    |

    Comment

    • Jeffrey Tan[MSFT]

      #3
      RE: How Do I: Send Text to a control in my User Control


      Hi Charles,

      Thank you for posting in this group.
      Is your user control created by yourself or by others?

      If it is created by yourself, you can create the label as the public
      reference of user control class.
      Then you can manipulate the label in the control like this:
      WebCustomContro l11.Label1.Text ="abc";

      Also(And more reasonable), you can create a public property for the label
      and you can manipulate it through the property.

      If the control is not created by yourself and it does not expose any
      property or public reference field for the label, it means that the creator
      of the usercontrol does not want you to manipulate it, this label is for
      some internal usage of this user control.

      Hope this helps,

      Best regards,
      Jeffrey Tan
      Microsoft Online Partner Support
      Get Secure! - www.microsoft.com/security
      This posting is provided "as is" with no warranties and confers no rights.

      --------------------
      | Content-Class: urn:content-classes:message
      | From: "Charles" <CWildner@bells outh.net>
      | Sender: "Charles" <CWildner@bells outh.net>
      | Subject: How Do I: Send Text to a control in my User Control
      | Date: Fri, 3 Oct 2003 16:59:29 -0700
      | Lines: 8
      | Message-ID: <1f97a01c38a0a$ 620cfbf0$a60128 0a@phx.gbl>
      | MIME-Version: 1.0
      | Content-Type: text/plain;
      | charset="iso-8859-1"
      | Content-Transfer-Encoding: 7bit
      | X-Newsreader: Microsoft CDO for Windows 2000
      | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
      | Thread-Index: AcOKCmIMy3y+hnz qR1Kn6CzbkEBKIA ==
      | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
      | Path: cpmsftngxa06.ph x.gbl
      | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1888 82
      | NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
      | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
      |
      | Hello,
      | I am in ASP.NET using C#.
      | I have a user control called "progHeader.asc x" that has
      | a label control call "pageTitle" . How do I
      | call "pageTitle" from my asp page(Inventory. aspx), with
      | the usercontrol "progheader " dropped on to it, and send
      | the current page title to "pageTitle" ?
      | Charles
      |

      Comment

      Working...