in MasterPage:
<asp:Label id="label1" runat="server"/> <input type="text" id="textbox1" runat="server"/>
in ContentPage.:
Label myLabel = (Label)Master.FindControl("label1"); myLabel.Text = "get ASP Label";
HtmlInputControl myBox = (HtmlInputControl)Master.FindControl("textbox1") myBox.Value = "get Html TextBox";
指定class:
in MasterPage:
<ul id="List" runat="server"> <li id="listItem1" runat="server"><a href="#">myLink</a></li> </ul>
in ContentPage:
HtmlGenericControl myList = (HtmlGenericControl)Master.FindControl("listItem1"); myList.Attributes.Add("class", "currentClassName");
指定單一屬性:
myList.Style.Add("background-color", "currentColor");
沒有留言:
張貼留言