编程控制控件Style属性
、可使用 WebControl 基类的 ApplyStyle 方法以编程方式设置 Web 服务器控件样式,如下面的代码所示。
<script language="C#" runat="server">
void Page_Load(Object Src, EventArgs E ) {
Style style = new Style();
style.BorderColor = Color.Black;
style.BorderStyle = BorderStyle.Dashed;
style.BorderWidth = 1;
MyLogin.ApplyStyle (style);
MyPassword.ApplyStyle (style);
MySubmit.ApplyStyle (style);
}
</script>
Login: <ASP:TextBox id="MyLogin" runat="server" />/<p/>
Password: <ASP:TextBox id="MyPassword" TextMode="Password" runat="server" />
View: <ASP:DropDownList id="MySelect" runat="server"> ... </ASP:DropDownList>
|
浙公网安备 33010602011771号