TextBox border color
the following asp.net source code help you to understand how can we set or change textbox control
border color at runtime. asp.net web server control BorderColor property accept standard color name as it value.
we can assign any valid color name for textbox border color. colored border textbox control make your web design
more attractive. we also can assign textbox border color programmatically in c# script section. for assigning a color we need
to use System.Drwing namespace.
TextBoxBorderColor.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
TextBox1.BorderColor = System.Drawing.Color.DarkCyan;
}
protected void Button2_Click(object sender, System.EventArgs e)
{
TextBox1.BorderColor = System.Drawing.Color.OrangeRed;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to set, change TextBox border color</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Green">TextBox Example: BorderColor</h2>
<asp:Label
ID="Label1"
runat="server"
Text="Country Name"
>
</asp:Label>
<asp:TextBox
ID="TextBox1"
runat="server"
Text="Your Country Name Here"
>
</asp:TextBox>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
ForeColor="SteelBlue"
Text="TextBox BorderColor DarkCyan"
OnClick="Button1_Click"
Font-Bold="true"
/>
<asp:Button
ID="Button2"
runat="server"
Font-Bold="true"
ForeColor="SteelBlue"
Text="TextBox BorderColor OrangeRed"
OnClick="Button2_Click"
/>
</div>
</form>
</body>
</html>


