English 中文(简体)
Ext. NET 网格板顶栏工具栏工具栏按钮在 DirectEvent 上引起内部服务器错误500 。
原标题:Ext.NET GridPanel topbar toolbar button raises Internal Server error 500 on DirectEvent Not raised in code behind

我和VS2008,ASP.NET使用Ext.NET。我有一个独特的问题,我一直无法找到任何解决办法。

网格栏有一个网格板, 顶部栏有一个删除按钮。 网格使用行选择模式。 在选择行后, 用户单击删除按钮。 客户端侧边活动会提出来确认 。 以下是代码片断 。

<ext:Button ID="btnDelete" runat="server" Text="Delete" Icon="Delete">
                    <DirectEvents>
                        <Click OnEvent="Evt_Delete">
                        <ExtraParams>
                        <ext:Parameter Name="recordId" Value="(#{grdSanction}).selModel.getSelected().data.VoucherID" Mode="Raw" />
                        </ExtraParams>

                            <Confirmation Message="Do you really want to delete sanction?" ConfirmRequest="true"/>
                        </Click>
                    </DirectEvents>
                </ext:Button>

但问题是,我在点击“是”之后,我得到了以下信息,基本上是一个500内部服务器错误。

以下是我在《小提琴手》中找到的:

Result Protocol Host URL Body Caching Content-Type Process Comments Custom
1 500 HTTP onyx /pages/sanction.aspx?_dc=1337773867270 4,268 private text/html; charset=utf-8 chrome:920

Debugger of VS2008 does not work because the event on the code behind is never raised. other buttons on the toolbar work just fine. Does anyone know what am I missing here?

问题回答

我认为你只需要把圆括号从 周围去掉。

// 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>




相关问题
How do I insert ToolBar separators when binding ItemSource

I am binding a ToolBar to a collection of command view model objects. The objects in the collection have a property IsSeparator that when true I would like represented with a <Separator/> in ...

Outlook shortcuts style toolbar in Qt

Is there any way to create outloook shortcuts style toolbar in Qt? Should use normal toolbar and try to style it somehow (I have little idea how to achieve this)? Or does Qt provide builtin widget for ...

How does Google get a toolbar right below the tabs in IE?

I researched through all BHO related documentation, but I just can t figure how Google gets the translation toolbar right below the tabs in IE. Any useful pointers how to achieve the same effect for ...

Powerbuilder: Trying to set the currentitem for a menuCascade

Please clue this newb in. I ve got a menu with it s object type set to menu cascade. I can reference the items in the menu just fine and I can even st the items to enabled or visible. But what I can ...

热门标签