Question about accessing usercontrol variables (VBasic)?

C

Chowny

I am fairly new to ASP .NET, and am busy teaching myself as I work through
my current project.

I'm a bit stumped at the moment. I have made a usercontrol called
"RelatedClaims" . The code as follows :

'********************************

Private sLinkType As String

Public Property LinkType() As String
Get
Return sLinkType
End Get
Set(ByVal Value As String)
sLinkType = Value
End Set
End Property
'********************************

On another web form (Companies.aspx) I have added the following to the html
:

<%@ Register TagPrefix="UserControl" TagName="RelatedClaims"
Src="RelatedClaims.ascx" %>



And then added the control to the page with the following :

<usercontrol:RelatedClaims runat="server"
ID="RelatedClaims1"></usercontrol:RelatedClaims>


Right. Now my problem is that I cannot access the control from with the VB
code of the companies.aspx form. If I code

RelatedClaims1.LinkType = "[WHATEVER]"

It highlights RelatedClaims1 and says it is not declared. What am I
forgetting to do? Any help appreciated.

Regards
 
C

Chowny

Ah. Got it now.

Needed to declare a protected variable with the same name as the component
ID. Sorted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top