View Full Version : Button postback with confirmation

Sep 26, 2011, 9:53 AM
Here's an example showing how to do a confirmation with an autopostback button.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PB.aspx.cs" Inherits="PB" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server"></ext:ResourceManager>
<script type="text/javascript">
var doPostbackWithConfirmation = function () {

var postBackFn = this.postback.fn
Ext.Msg.confirm('Confirm', 'Are you sure?', function (btn) {
//console.log(this, arguments);
if (btn == 'yes') { postBackFn(); }

return false;

<ext:Button runat="server" AutoPostBack="true" OnClick="DoServerWork" Text="Do Server Stuff">
<Click Fn="doPostbackWithConfirmation" />


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;

public partial class PB : System.Web.UI.Page

protected void DoServerWork(object sender, EventArgs e)

Notification.Show(new NotificationConfig
Title = "Title",
Icon = Icon.Information,
Html = "Well Played"


Sep 27, 2011, 12:48 PM

Thanks for sharing.

Sep 28, 2011, 4:53 PM
great sample
very thanks
I will write ExtJS articles coming soon