QUESTIONS
- How to set master page object id (e.g div id) in code behind (VB)?
- How to change the id in child pages?
Root.Master
<%@ Master Language="VB" CodeFile="~/Root.master.vb" Inherits="Root"%>
<div id="<%=MyPage%>">
<asp:ContentPlaceHolder ID="Content" RunAt="Server"/>
</div>
Root.Master.vb
Partial Class Root
Inherits BaseMaster
End Class
Page.vb (In App_Code Folder)
Public Class BaseMaster
Inherits System.Web.UI.MasterPage
Public MyPage As String
End Class
Index.aspx.vb
Partial Class Index
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CType(Me.Master, BaseMaster).MyPage = "Page"
End Sub
End Class