我认为您只需要从#{grdSantion}
.
// Not OK
(#{grdSanction}).selModel.getSelected().data.VoucherID
// OK
#{grdSanction}.selModel.getSelected().data.VoucherID
以下示例演示了完整方案,并且似乎可以根据您的要求工作。
例子
<%@ 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)
{
var store = this.GridPanel1.GetStore();
store.DataSource = this.Data;
store.DataBind();
}
}
private object[] Data
{
get
{
return new object[]
{
new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
new object[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" },
new object[] { "AT&T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am" },
new object[] { "Boeing Co.", 75.43, 0.53, 0.71, "9/1 12:00am" },
new object[] { "Caterpillar Inc.", 67.27, 0.92, 1.39, "9/1 12:00am" }
};
}
}
protected void Button1_Click(object sender, DirectEventArgs e)
{
X.Msg.Notify("Company", e.ExtraParams["company"]).Show();
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel
ID="GridPanel1"
runat="server"
Title="Array Grid"
Width="350"
Height="215">
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server" Text="Delete" Icon="Delete">
<DirectEvents>
<Click OnEvent="Button1_Click">
<ExtraParams>
<ext:Parameter Name="company" Value="#{GridPanel1}.selModel.getSelected().data.company" Mode="Raw" />
</ExtraParams>
<Confirmation Message="Do you really want to delete sanction?" ConfirmRequest="true"/>
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Store>
<ext:Store runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="company" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column ColumnID="Company" Header="Company" DataIndex="company" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel runat="server" SingleSelect="true" />
</SelectionModel>
</ext:GridPanel>
</form>
</body>
</html>