Tuesday, March 13, 2012

set public property in another web user control

I have two user controls in a web form...user control 1 contains just a
label, but I want to set its value from another web user control (2) in the
same web form. I am able to set the value from the web form, but not from
the user control 2...what am I doing wrong?

This is in the web form:

<uc1:statusMessage id="StatusMessage1" runat="server"></uc1:statusMessage
This is in the first user control 1:

Public theMessage As String
Public Property statusMessage() As String
Get
lblStatusMessage.Text = theMessage
End Get
Set(ByVal Value As String)
theMessage = Value
End Set
End Property

This is in the user control 2:

Public WithEvents statusMessage1 As statusMessage
statusMessage1.theMessage = "No communities selected"

_____
DC GDingo:
Check out:
http://openmymind.net/index.aspx?documentId=9

I'm in a rush, else I'd explain in great detail :) lemme know if that solved
it for you...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)

"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:OgKTBCgSFHA.3176@.TK2MSFTNGP09.phx.gbl...
>I have two user controls in a web form...user control 1 contains just a
>label, but I want to set its value from another web user control (2) in the
>same web form. I am able to set the value from the web form, but not from
>the user control 2...what am I doing wrong?
> This is in the web form:
> <uc1:statusMessage id="StatusMessage1" runat="server"></uc1:statusMessage>
>
> This is in the first user control 1:
> Public theMessage As String
> Public Property statusMessage() As String
> Get
> lblStatusMessage.Text = theMessage
> End Get
> Set(ByVal Value As String)
> theMessage = Value
> End Set
> End Property
>
>
> This is in the user control 2:
> Public WithEvents statusMessage1 As statusMessage
> statusMessage1.theMessage = "No communities selected"
> _____
> DC G

0 comments:

Post a Comment