<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<p>
<asp:LinkButton ID="LinkButton" runat="server" OnClick="Button_Click">Click Me</asp:LinkButton>
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="LinkButton" ConfirmText="Are you sure you want to click the LinkButton?" />
<br />
<br />
<asp:Button ID="Button" runat="server" Text="Click Me" OnClick="Button_Click" /><br />
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server" TargetControlID="Button" ConfirmText="Are you sure you want to click the Button?" />
<br />
</p>
<asp:Label ID="Label1" runat="server"></asp:Label>
</contenttemplate>
</asp:UpdatePanel>
CS代码:<contenttemplate>
<p>
<asp:LinkButton ID="LinkButton" runat="server" OnClick="Button_Click">Click Me</asp:LinkButton>
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="LinkButton" ConfirmText="Are you sure you want to click the LinkButton?" />
<br />
<br />
<asp:Button ID="Button" runat="server" Text="Click Me" OnClick="Button_Click" /><br />
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server" TargetControlID="Button" ConfirmText="Are you sure you want to click the Button?" />
<br />
</p>
<asp:Label ID="Label1" runat="server"></asp:Label>
</contenttemplate>
</asp:UpdatePanel>
protected void Button_Click(object sender, EventArgs e)
{
Label1.Text = "You clicked the " + ((Control)sender).ID + " at " + DateTime.Now.ToLongTimeString() + ".";
}
{
Label1.Text = "You clicked the " + ((Control)sender).ID + " at " + DateTime.Now.ToLongTimeString() + ".";
}
更简单的方法:
this.Button1.Attributes["onclick"]="javascript:return confirm('确定要停止下载么?');";