<%@ Page Language="vb" AutoEventWireup="true" CodeFile="InsertForm.aspx.vb" Inherits="InsertFormVB" %>

<!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">
    <title>Untitled Page</title>

    <script type="text/javascript">
		    function CloseAndRebind(arg)
		    {
			    GetRadWindow().Close();
			    GetRadWindow().BrowserWindow.refreshGrid(arg);
		    }
    		
		    function GetRadWindow()
		    {
			    var oWindow = null;
			    if (window.radWindow) 
			    {
			        oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
			    }
			    else if (window.frameElement.radWindow) 
			    {
			        oWindow = window.frameElement.radWindow;//IE (and Moz as well)
			    }
    				
			    return oWindow;
		    }

		    function CancelEdit()
		    {
		        GetRadWindow().Close();		
		    }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:DetailsView ID="DetailsView1" DataKeyNames="EmployeeID" runat="server" DefaultMode="Insert"
                AutoGenerateRows="False" DataSourceID="AccessDataSource1" Height="50px" Width="125px">
                <Fields>
                    <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                    <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
                    <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                    <asp:CommandField ShowInsertButton="True" />
                </Fields>
            </asp:DetailsView>
            <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/NWind.mdb"
                InsertCommand="INSERT INTO [Employees] ([FirstName], [LastName], [Title]) VALUES (?, ?, ?)"
                SelectCommand="SELECT [EmployeeID], [FirstName], [LastName], [Title] FROM [Employees] WHERE ([EmployeeID] = ?)">
                <SelectParameters>
                    <asp:QueryStringParameter Name="EmployeeID" QueryStringField="employeeid" Type="Int32" />
                </SelectParameters>
                <InsertParameters>
                    <asp:Parameter Name="FirstName" Type="String" />
                    <asp:Parameter Name="LastName" Type="String" />
                    <asp:Parameter Name="Title" Type="String" />
                </InsertParameters>
            </asp:AccessDataSource>
        </div>
    </form>
</body>
</html>
