Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / MonoRail / TestSite / views / binding / DataBound.aspx
blob1e121d511b464d37cfd12f1275ff5da86d6ba93a
1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DataBound.aspx.cs" Inherits="AspnetSample.views.DataBound" %>\r
2 \r
3 <%@ Register Assembly="Castle.MonoRail.Framework" Namespace="Castle.MonoRail.Framework.Views.Aspx" TagPrefix="mr" %>\r
4 \r
5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
6 \r
7 <html xmlns="http://www.w3.org/1999/xhtml" >\r
8 <head runat="server">\r
9     <title>Binding Actions to DataBound Controls</title>\r
10     <style type="text/css">\r
11                 li\r
12                 {\r
13                         margin-top: 10px;\r
14                 }\r
15 </style>\r
16 </head>\r
17 <body>\r
18     <form id="form1" runat="server">\r
19                 <h2>DataBound Controls</h2>\r
20                 <ul>\r
21                         <li>GridView:<asp:GridView ID="grdEmployees" runat="server" DataSource="<%# Employees %>"\r
22                                 DataKeyNames="Id,Name" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" AutoGenerateSelectButton="True" \r
23                                 AllowSorting="true" OnRowEditing="grdEmployees_RowEditing" OnSorting="grdEmployees_Sorting">\r
24                         </asp:GridView>\r
25                         </li>\r
26                 </ul>\r
27                 <asp:HyperLink ID="lnkIndex" NavigateUrl="~/binding/Index.rails" runat="server">Index</asp:HyperLink>   \r
28     </form>\r
29     <mr:ControllerBinder ID="ControllerBinder" runat="server">\r
30                 <ControllerBindings>\r
31                         <mr:ControllerBinding ControlID="grdEmployees">\r
32                                 <mr:ActionBinding EventName="RowCommand">\r
33                                         <CommandBindings>\r
34                                                 <mr:CommandBinding ActionName="SelectRow" CommandName="Select">\r
35                                                 </mr:CommandBinding>\r
36                                                 <mr:CommandBinding ActionName="EditRow" CommandName="Edit">\r
37                                                 </mr:CommandBinding>\r
38                                                 <mr:CommandBinding ActionName="SortRows" CommandName="Sort">\r
39                                                 </mr:CommandBinding>\r
40                                         </CommandBindings>\r
41                                         <ActionArguments>\r
42                                                 <mr:ActionArgument Expression="$event.CommandArgument" Name="argument" />\r
43                                                 <mr:ActionArgument Expression="$this.DataKeys[$event.CommandArgument].Value" Name="id" />\r
44                                                 <mr:ActionArgument Expression="$this.DataKeys[$event.CommandArgument]['Name']" Name="name" />\r
45                                         </ActionArguments>\r
46                                 </mr:ActionBinding>\r
47                                 <mr:ActionBinding ActionName="DeleteRow" EventName="RowDeleting">\r
48                                         <ActionArguments>\r
49                                                 <mr:ActionArgument Expression="$event.RowIndex" Name="rowIndex" />\r
50                                         </ActionArguments>\r
51                                 </mr:ActionBinding>\r
52                         </mr:ControllerBinding>\r
53                 </ControllerBindings>\r
54     </mr:ControllerBinder>\r
55 </body>\r
56 </html>\r