<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

                <script type="text/javascript">   
                var oldConfirm = radconfirm;      
             
                window.radconfirm = function(text, mozEvent)      
                {      
                    var ev = mozEvent ? mozEvent : window.event; //Moz support requires passing the event argument manually      
                    //Cancel the event      
                    ev.cancelBubble = true;      
                    ev.returnValue = false;      
                    if (ev.stopPropagation) ev.stopPropagation();      
                    if (ev.preventDefault) ev.preventDefault();      
                          
                    //Determine who is the caller      
                    var callerObj = ev.srcElement ? ev.srcElement : ev.target;      
             
                    //Call the original radconfirm and pass it all necessary parameters      
                    if (callerObj)       
                    {      
                        //Show the confirm, then when it is closing, if returned value was true, automatically call the caller's click method again.      
                        var callBackFn = function (arg)      
                        {                 
                            if (arg)      
                            {                 
                                callerObj["onclick"] = "";                
                                if (callerObj.click) callerObj.click(); //Works fine every time in IE, but does not work for links in Moz      
                                else if (callerObj.tagName == "A") //We assume it is a link button!      
                                {                                                             
                                    try     
                                    {      
                                        eval(callerObj.href)      
                                    }      
                                    catch(e){}      
                                }      
                            }      
                        }             
                        oldConfirm(text, callBackFn, 300, 100, null);         
                    }      
                    return false;      
                }     
  
                </script>

            </telerik:RadCodeBlock>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadWindowManager ID="WindowManager1" runat="server" />
            <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AllowSorting="True"
                ShowStatusBar="true" GridLines="None" Width="95%" AutoGenerateDeleteColumn="true">
                <MasterTableView Width="100%" DataKeyNames="EmployeeID" AllowAutomaticDeletes="true" />
            </telerik:RadGrid>
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                ProviderName="System.Data.SqlClient" 
                SelectCommand="SELECT EmployeeID, LastName, FirstName, Title, City FROM Employees"
                DeleteCommand="DELETE from Employees WHERE EmployeeID = @EmployeeID"
                runat="server">
            <DeleteParameters>
              <asp:Parameter Name="EmployeeID" Type="int32" />
            </DeleteParameters>    
            </asp:SqlDataSource>
        </div>
    </form>
</body>
</html>
