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

<%@ Register TagPrefix="radG" Namespace="Telerik.WebControls" Assembly="RadGrid.Net2" %>
<%@ Register TagPrefix="radW" Namespace="Telerik.WebControls" Assembly="RadWindow.Net2" %>

<!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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    			<script language="javascript">
				function ShowEditForm(id, rowIndex)
				{
				    var grid = window["<%= RadGrid1.ClientID %>"];
                
                    var rowControl = grid.MasterTableView.Rows[rowIndex].Control;                
                    grid.MasterTableView.SelectRow(rowControl, true);
                   
					window.radopen("EditForm.aspx?EmployeeId=" + id, "UserListDialog");
					return false; 
				}
                function ShowInsertForm()
                {
                   window.radopen("InsertForm.aspx", "UserListDialog");
                   return false;
                }
				function refreshGrid(arg)
				{
				    if(!arg)
				    {
					  window["<%=RadGrid1.ClientID %>"].AjaxRequest('<%= RadGrid1.UniqueID %>', 'Rebind');
					}
					else
					{
					  window["<%=RadGrid1.ClientID %>"].AjaxRequest('<%= RadGrid1.UniqueID %>', 'RebindAndNavigate');
					}
				}
			</script>
			<radg:radgrid id="RadGrid1" runat="server" AllowSorting="True" AllowPaging="True" EnableAJAX="True" Skin="Glassy">
				<PagerStyle Mode="NumericPages" />
				<MasterTableView DataKeyNames="EmployeeID" CommandItemDisplay="Top" AutoGenerateColumns="False" PageSize="5">
					<Columns>
						<radg:GridBoundColumn HeaderText="First name" DataField="FirstName" UniqueName="FirstName" />
						<radg:GridBoundColumn HeaderText="Last name" DataField="LastName" UniqueName="LastName" />
						<radg:GridBoundColumn HeaderText="Title" DataField="Title" UniqueName="Title" />
						<radg:GridTemplateColumn UniqueName="TemplateEditColumn">
							<ItemTemplate>
								<a runat="server" id="EditAnchor" title="Edit">Edit</a>
							</ItemTemplate>
						</radg:GridTemplateColumn>
					</Columns>
					<CommandItemTemplate>
						<input type="image" src="RadControls/Grid/Skins/Default/AddRecord.gif" title="Add record" />
						<a href="" onclick="return ShowInsertForm()">Add new record</a>
					</CommandItemTemplate>
				</MasterTableView>
				<ClientSettings>
				  <Selecting AllowRowSelect="true" />
				</ClientSettings>
			</radg:radgrid>
			<radw:radwindowmanager id="RadWindowManager1" runat="server">
				<WINDOWS>
					<RADW:RADWINDOW id="UserListDialog" title="User List Dialog" Height="400px" Width="300px" Runat="server"
						Left="150px" ReloadOnShow="true" Modal="true" />
				</WINDOWS>
			</radw:radwindowmanager>
    </div>
    </form>
</body>
</html>
