1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DataBound.aspx.cs" Inherits="AspnetSample.views.DataBound" %>
\r
3 <%@ Register Assembly="Castle.MonoRail.Framework" Namespace="Castle.MonoRail.Framework.Views.Aspx" TagPrefix="mr" %>
\r
5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
\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
18 <form id="form1" runat="server">
\r
19 <h2>DataBound Controls</h2>
\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
27 <asp:HyperLink ID="lnkIndex" NavigateUrl="~/binding/Index.rails" runat="server">Index</asp:HyperLink>
\r
29 <mr:ControllerBinder ID="ControllerBinder" runat="server">
\r
30 <ControllerBindings>
\r
31 <mr:ControllerBinding ControlID="grdEmployees">
\r
32 <mr:ActionBinding EventName="RowCommand">
\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
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
47 <mr:ActionBinding ActionName="DeleteRow" EventName="RowDeleting">
\r
49 <mr:ActionArgument Expression="$event.RowIndex" Name="rowIndex" />
\r
52 </mr:ControllerBinding>
\r
53 </ControllerBindings>
\r
54 </mr:ControllerBinder>
\r