View Full Version : [CLOSED] GridCommand Handler

Dec 18, 2014, 5:44 AM
This is my test Source,

<ext:CommandColumn ID="CommandColumn1" runat="server" Width="110">
<ext:GridCommand Icon="Delete" CommandName="Delete" Text="Delete"/>
<Command Handler="Ext.Msg.alert(command, record.data.PCNo);" />

I wanna use Command Handler to working like below script of OnDiretClick Event.
btnDelete_Click is a code behind command.
for Example

<ext:Button ID="Button4" runat="server" Text="Delete" Icon="Delete" OnDirectClick="btnDelete_Click" />

How to alternate "Ext.Msg.alert(command, record.data.PCNo);" ?

Dec 18, 2014, 7:06 AM
Hi @rockhome,

Hope this example helps.


<%@ Page Language="C#" %>

<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[] { "test1" },
new object[] { "test2"}

protected void CommandColumn_Command(object sender, DirectEventArgs e)
X.Msg.Alert(e.ExtraParams["command"], e.ExtraParams["data"]).Show();

<!DOCTYPE html>

<head runat="server">
<title>Ext.NET v2 Example</title>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:GridPanel ID="GridPanel1" runat="server">
<ext:Store runat="server">
<ext:Model runat="server">
<ext:ModelField Name="test" />
<ColumnModel runat="server">
<ext:Column runat="server" Text="Test" DataIndex="test" />
<ext:CommandColumn runat="server">
<ext:GridCommand Icon="Delete" CommandName="Delete" Text="Delete" />
<Command OnEvent="CommandColumn_Command">
<ext:Parameter Name="command" Value="command" Mode="Raw" />
<ext:Parameter Name="data" Value="record.data.test" Mode="Raw" />

Dec 18, 2014, 7:52 AM
It's working well.
Thanks a lot.