Link to home
Start Free TrialLog in
Avatar of mgmhicks
mgmhicks

asked on

Retrieve page public property from jquery

I have a master page with the following code.

 Public Property UserType As String
        Get
            Return mUserType
        End Get
        Set(value As String)
            mUserType = value
        End Set
    End Property


Now I can of course access that property when a page loads.  So when I load the content page, I assign the usertype ="P"

So after content page loads I need jquery on Master page to run that looks at the usertype and hides a <ul> with the ID of "type"

So I need a document.ready script on the master page that can get the value of usertype and either hide or show based on the value c or p

I know how to do it with a control, but not sure with a property value.

thanks
Avatar of Duy Pham
Duy Pham
Flag of Viet Nam image

One simple way is to use Hidden field to stored that property rather than a member variable.
In your .aspx, add a Hidden field
...
<asp:Hidden ID="hfUserType" runat="server" Value="" />
...

Open in new window


In your .aspx.vb file, change the code of UserType property as below:
Public Property UserType As String
         Get
             Return hfUserType.Value
         End Get
         Set(value As String)
             hfUserType.Value = value
         End Set
End Property

Open in new window

SOLUTION
Avatar of Swapnil
Swapnil
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial