asp.net - How to change a Panel border style programmatically

Panel border style
Panel is an asp.net web server control. this server control act as a container control for other controls. we can apply different border styles of panel server control's programmatically by using its built in property.

panel control's BorderStyle property get or set the border style of panel server control. the BorderStyle property value type is System.Web.UI.WebControls.BorderStyle. the 'BorderStyle' is one of the BorderStyle enumeration value. the default value of BorderStyle property is NotSet. BorderStyle enumeration have the following possible values NotSet, None, Dotted, Dashed, Solid, Double, Groove, Inset, Ridge and Outset. this property make panel's look and feel user friendly.

the following asp.net c# example code demonstrate us how can we set or change the panel server control's border style dynamically at run time in an asp.net application.
PanelBorderStyle.aspx

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

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Panel1.BorderStyle = BorderStyle.Inset;

    }
    protected void Button2_Click(object sender, System.EventArgs e)
    {
        Panel1.BorderStyle = BorderStyle.Outset;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to set, change Panel border style programmatically</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy; font-style:italic;">Panel Example: BorderStyle</h2>
        <asp:Panel 
             ID="Panel1"
             runat="server"
             Height="150"
             Width="350"
             HorizontalAlign="Center"
             ForeColor="BurlyWood"
             BackColor="PapayaWhip"
             BorderWidth="2"
             >
             <br /><br />
             <h2>Panel Border Style</h2>
        </asp:Panel>
        <br /><br />
        <asp:Button 
             ID="Button1" 
             runat="server"
             ForeColor="DarkGray"
             Text="Panel Inset Border Style"
             Height="45"
             OnClick="Button1_Click"
             Font-Bold="true"
             />
        <asp:Button 
             ID="Button2" 
             runat="server"
             ForeColor="DarkGray"
             Text="Panel Outset Border Style"
             Height="45"
             OnClick="Button2_Click"
             Font-Bold="true"
             />
    </div>
    </form>
</body>
</html>
More asp.net examples