We help IT Professionals succeed at work.

How to access sub from master page inside web user control?

Wigging
Wigging asked
on
i am adding this inside html of user control
<%@ MasterType VirtualPath="~/Site1.master" %>

then

in code behind of user control

    Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        Master.culturecode()
        c1.sendEmail("gbarraza@woodmizer.com", "gbarraza@woodmizer.com", Now.Millisecond, "welcome " + Thread.CurrentThread.CurrentCulture.ToString)

        LoadStrings(Thread.CurrentThread.CurrentCulture)
    End Sub
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
>Master.culturecode()

And? What is happening? Did you try

Page.Master.culturecode()

?

Author

Commented:
I think web user control does not like this below???

<%@ MasterType VirtualPath="~/Site1.master" %>
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Why are you not setting the master page on the page that is hosting the user control?
Obadiah ChristopherDeveloper User Interface
CERTIFIED EXPERT
Commented:
Dim siteMaster As Site1 = TryCast(Me.Page.Master, Site1)

siteMaster.CultureCode()

Open in new window

Explore More ContentExplore courses, solutions, and other research materials related to this topic.