0

こんにちは、1 つの UserControl (GridPanel を含む) を tabPanel にロードしています。

しかし、Gridpanel Edit Command Button をクリックすると、サーバー側のイベント メソッドが機能せず、次のような例外が表示されます。

例外の詳細: System.Web.HttpException: ID 'id8b177c82adb2e925' のコントロールが見つかりません。

私のコードはここにあります

userControl の場合: .ascx コードは

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GridPanelUserControl.ascx.cs" Inherits="Ext_PracticeExamples.GridPanelUserControl" %>


<ext:GridPanel ID="gpEmployeeList" runat="server" StripeRows="true" Title="Employee List" Layout="FitLayout"
    Width="620" Height="400" AutoExpandColumn="FirstName">

    <Store>
       .....  
    </Store>
    <ColumnModel ID="ColumnModel1" runat="server">
        <Columns>

              <ext:ImageCommandColumn ID="imgSettings"    runat="server" Text="Settings" Resizable="false">
                <Commands>
                    <ext:ImageCommand Icon="BasketEdit" Style="text-align: center" CommandName="Settings">
                    </ext:ImageCommand>
                </Commands>
                <Listeners>
                    <Command Handler=" #{DirectMethods}.fnDisplaySettings(record.data.Company,record.data.Price,record.data.Change);" />

                </Listeners>
            </ext:ImageCommandColumn>
        </Columns>
    </ColumnModel>

および起動していない対応する.csクラスファイルメソッド。

  [DirectMethod]
     public void fnDisplaySettings(string name, double X, double Y)
     {     
      // ..some Operation....    
         Response.Redirect("~/_Default.aspx");
     }

webBrowser でソース ページを観察しているときに、コントロールの ID が異なるため、対応する関数が表示されないことがわかりました。UserControl を使用せずに単一ページでこのコードを使用すると、正常に動作します。

サーバー側のメソッドを呼び出します。

ありがとうございました

4

1 に答える 1

2

サーバー上にユーザー コントロール インスタンスがないため、Ext.NET はその DirectMethod を見つけることができません。

考えられる解決策は次のとおりです。

  1. 要求ごとにユーザー コントロールを再作成します。これは、Ext.NET フォーラムでの関連する議論です。

  2. WebService (asmx) や HTTP ハンドラー (ashx) などに DirectMethod のハンドラーを設定し、URL 経由で呼び出します。このような呼び出しには、ユーザー コントロール インスタンスは必要ありません。以下に例を示します。 http://examples.ext.net/#/Events/DirectMethods/WebService/
    http://examples.ext.net/#/Events/DirectEvents/WebService/

このアプローチの欠点は、WebService または HTTP ハンドラーでユーザー コントロールのコントロールにアクセスできないことです。必要なものはすべて、リクエストの追加パラメーターとしてページから送信する必要があります。

  1. ページに DirectMethod を配置します。
于 2013-06-26T05:28:16.523 に答える