c# - How to get stopwatch elapsed time

c# example - Stopwatch elapsed time
stopwatch-elapsed-time.aspx

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

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Label1.Text = "";
        System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
        sw.Start();

        for (int i = 0; i < 1500;i++ )
        {
            //blank loop
        }
        sw.Stop();
        string output = String.Format("Time elapsed: {0}ms",sw.Elapsed.TotalMilliseconds);
        Label1.Text += output;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>c# example - Stopwatch elapsed time</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:DarkBlue; font-style:italic;">
            c# example - Stopwatch elapsed time
        </h2>  
        <hr width="550" align="left" color="LightBlue" />  

        <asp:Label 
            ID="Label1" 
            runat="server"
            Font-Size="XX-Large"
            >
        </asp:Label>
        <br /><br />
        <asp:Button 
            ID="Button1" 
            runat="server" 
            Text="Show Stopwatch elapsed Time" 
            OnClick="Button1_Click"
            Height="40"
            Font-Bold="true"
            />
    </div>
    </form>
</body>
</html>