EXT.NET GridPanel(按键事件带参的另一种写法)

<% @ Page Language= "C#" %>
  
<% @ Register Assembly= "Ext.Net" Namespace= "Ext.Net" TagPrefix= "ext" %>
  
< script runat = "server" >
     protected void Page_Load(object sender, EventArgs e)
     {
         if (!X.IsAjaxRequest)
         {
             Store store = this.GridPanel1.GetStore();
             store.DataSource = new object[] 
            
                 new object[] { "id1", "test1" },
                 new object[] { "id2", "test2" },
                 new object[] { "id3", "test3" }
             };
             store.DataBind();
         }
     }
  
     protected void Command(object sender, DirectEventArgs e)
     {
         X.Msg.Alert("Command", e.ExtraParams["id"] + " : " + e.ExtraParams["command"]).Show();
     }
</ script >
  
<!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 >Ext.Net Example</ title >
</ head >
< body >
     < form runat = "server" >
     < ext:ResourceManager runat = "server" />
     < ext:GridPanel ID = "GridPanel1" runat = "server" AutoHeight = "true" >
         < Store >
             < ext:Store runat = "server" >
                 < Reader >
                     < ext:ArrayReader >
                         < Fields >
                             < ext:RecordField Name = "id" />
                             < ext:RecordField Name = "test" />
                         </ Fields >
                     </ ext:ArrayReader >
                 </ Reader >
             </ ext:Store >
         </ Store >
         < ColumnModel runat = "server" >
             < Columns >
                 < ext:Column Header = "Test" DataIndex = "test" />
                 < ext:CommandColumn Width = "60" >
                     < Commands >
                         < ext:GridCommand Icon = "Delete" CommandName = "Delete" />
                         < ext:GridCommand Icon = "NoteEdit" CommandName = "Edit" />
                     </ Commands >
                 </ ext:CommandColumn >
             </ Columns >
         </ ColumnModel >
         < DirectEvents >
             < Command OnEvent = "Command" >
                 < ExtraParams >
                     < ext:Parameter Name = "id" Value = "record.data.id" Mode = "Raw" />
                     < ext:Parameter Name = "command" Value = "command" Mode = "Raw" />    //get the GridCommand name
                 </ ExtraParams >
             </ Command >
         </ DirectEvents >
     </ ext:GridPanel >
     </ form >
</ body >
</ html >

你可能感兴趣的:(gridPanel)