<%@ Import namespace="System.Drawing" %>
<html>
<head>
<title>WebControl BorderColor Property</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
void Page_Load ( Object src, EventArgs e ) {
if ( !IsPostBack ) {
Array colors = Enum.GetValues ( typeof ( KnownColor ) );
foreach ( KnownColor k in colors ) {
Color c = Color.FromKnownColor ( k );
if ( !c.IsSystemColor )
colorSelect.Items.Add ( c.Name );
}
}
myTable.BorderColor = Color.FromName ( colorSelect.SelectedItem.Text );
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h2>Dynamically Setting the BorderColor Property of a Web Control</h2></div>
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<asp:table id="myTable" runat="server"
cellpadding=10
gridlines="Both"
borderstyle="Ridge"
borderwidth=10
backcolor="Ivory">
<asp:tablerow>
<asp:tablecell><img src="/shared/images/samp01.jpg"
width=150 height=150 border=0 alt=""></asp:tablecell>
</asp:tablerow>
</asp:table>
<p>Select a color:
<asp:dropdownlist id="colorSelect" autopostback runat="server" />
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>