I provided a full working example. First you need at least one server (postback) control so that the method __doPostBack ist included by the render engine. On closing the dialog you call the postback in order to call the server method.
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SimplePage.aspx.cs" Inherits="DeleteMeEgal.SimplePage"%>
<html>
<head runat="server">
<title></title>
</head>
<body>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.js"></script>
<form id="form1" runat="server">
<div>
Button:
<asp:ImageButton ClientIDMode="Static" ID="ImageButton1"
ImageUrl="http://www.heise.de/icons/ho/heise_online_lupe.gif" runat="server"
onclick="ImageButton1_Click1"></asp:ImageButton>
<script type="text/javascript">
$(document).ready(function () {
$('#ImageButton1').click(function () {
$("#dialog").dialog(
{
buttons: {
Close: function () {
$(this).dialog('close');
__doPostBack('ImageButton1', '');
}
},
modal: true
});
return false;
});
});
</script>
</div>
<div style="visibility: hidden">
<div id="dialog" title="Basic dialog" >
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
</div>
<%-- included to force __doPostBack javascript function to be rendered --%>
<asp:LinkButton ID="LinkButton1" runat="server" />
</form>
</body>
</html>
Code Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace DeleteMeEgal
{
public partial class SimplePage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ImageButton1_Click1(object sender, ImageClickEventArgs e)
{
Response.Write("You ran the ImageButton1_Click click event");
}
}
}