First of all, we should search about the content place
holder of the outer master page, and then search about the content place holder
of the inner master page. Finally, we will search deeply inside the two content
place holders about our label control.
Listing 4 is the code that you need to write.
Listing 4: Find control inside nested master pages
' Outer Master Page
Dim Outer_CP As ContentPlaceHolder
Outer_CP = TryCast(Me.Master.Master.FindControl("ContentPlaceHolder1"), _
ContentPlaceHolder)
' Inner Master Page
Dim Inner_CP As ContentPlaceHolder
Inner_CP = TryCast(Outer_CP.FindControl("ContentPlaceHolder2"), _
ContentPlaceHolder)
Dim lbl As Label = TryCast(Inner_CP.FindControl("Label1"), Label)
lbl.Text = "Text was changed inside nested master page!"