如果在Master Pages的應用程式,需要在
裡面增加屬性,例如要在Client Script Function加個onload事件,你會發現你不能直接下,因為在Master Page,不是在你的Content Page。
如果在Master Pages的應用程式,需要在<BODY>裡面增加屬性,例如要在Client Script Function加個onload事件,你會發現你不能直接下,
因為<BODY>在Master Page,不是在你的Content Page。
所以方法是要為Master Page的<BODY>設一個Public Property,這樣任何的Content Page 就能取得這個Property
第一:要在Master Page<BODY>改成ASP.NET Server Control
<BODY> to <BODY id="MasterPageBodyTag" runat="server">
現在<BODY>是一個Server Control,就可以設定他的Public Property
然後再MasterPage加個Public Property












在Content Page的ASPX裡加上<%@ MasterType TypeName="MyMasterPage" %>
然後在Content Page使用Master Page的BodyTag Property增加到<BODY>
這樣就行了


