asp.net - How to change a TextBox border width programmatically

Change TextBox border width programmatically
this tutorial show us how can we set or change textbox border width programmatically. asp.net textbox web server control BorderWidth property accept a numeric value. by entering BorderWidth property value you can set or change textbox control border width. in this example we create two button and a textbox control. when someone click the specified button then it change textbox border width as commanded. we also can declare textbox border width initially in TextBox tag.
TextBoxBorderWidth.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        TextBox1.BorderWidth = 4;
    }
    protected void Button2_Click(object sender, System.EventArgs e)
    {
        TextBox1.BorderWidth = 6;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to set, change TextBox border width</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">TextBox Example: BorderWidth</h2>
        <asp:Label 
             ID="Label1" 
             runat="server"
             Text="Country Name"
             >
        </asp:Label>
        <asp:TextBox 
             ID="TextBox1" 
             runat="server"
             BorderColor="SeaGreen"
             >
        </asp:TextBox>
        <br /><br />
        <asp:Button 
             ID="Button1" 
             runat="server" 
             ForeColor="HotPink"
             Text="TextBox BorderWidth 4"
             OnClick="Button1_Click"
             Font-Bold="true"
             />
        <asp:Button 
             ID="Button2" 
             runat="server" 
             Font-Bold="true"
             ForeColor="HotPink"
             Text="TextBox BorderWidth 6"
             OnClick="Button2_Click"
             />
    </div>
    </form>
</body>
</html>
Related asp.net example