我正在使用VB.net和ext.net(版本1.6)。
我有一个Gridpanel,我可以双击一行来编辑它。 我可以成功编辑它,但是我需要在完成编辑时调用直接事件(为了更新数据库中的行)。
我试过了:
<ext:Column ColumnID="Name" dataindex="Name" Header="Field" Width="210" >
<Editor>
<ext:TextField ID="TextField00" runat="server" />
</Editor>
</ext:Column>
以及列之外:
<DirectEvents>
<AfterEdit OnEvent="UpdateFieldValue"></AfterEdit>
</DirectEvents>
感谢
答案 0 :(得分:1)
它适用于此示例。
<%@ 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[] { "test1" },
new object[] { "test2" },
new object[] { "test3" }
};
store.DataBind();
}
}
protected void GridPanel_AfterEdit(object sender, DirectEventArgs e)
{
X.Msg.Alert("GridPanel_AfterEdit", "Hello from Server!").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="test" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column Header="Test" DataIndex="test">
<Editor>
<ext:TextField runat="server" />
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<DirectEvents>
<AfterEdit OnEvent="GridPanel_AfterEdit" />
</DirectEvents>
</ext:GridPanel>
</form>
</body>
</html>
希望这有帮助。