ASP.Net/Development/Client Event

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

asp button on client click (C#)

<%@ Page Language="C#" %>
<script runat="server">
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        lblResult.Text = "All pages deleted!";
    }
</script>
<html>
<head>
    <title>Button OnClientClick</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    <asp:Button
        id="btnDelete"
        Text="Delete Website"
        OnClick="btnDelete_Click"
        OnClientClick="return confirm("Are you sure?");" 
        Runat="server" />
    
    <asp:Label
        id="lblResult"
        Runat="server" />    
    
    </div>
    </form>
</body>
</html>