0

動作するグリッドビューがあり、データバインドされた列が適切な情報を抽出しますが、テンプレートフィールドを追加しようとすると、ブラウザーで次のエラーが発生します。

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'ASP.componentcontrols_userdetails_detailgridcontrol_ascx' does not contain a definition for 'gwOrderInvQuote_SelectedIndexChanged' and no extension method 'gwOrderInvQuote_SelectedIndexChanged' accepting a first argument of type 'ASP.componentcontrols_userdetails_detailgridcontrol_ascx' could be found (are you missing a using directive or an assembly reference?)

私がそれをそのように宣言したグリッドビュー:

     <asp:View ID="Foo" runat="server">
                <asp:GridView ID="Foo" runat="server" DataKeyNames="id"
                    DataSourceID="odsFoo" Width="631px" OnRowDataBound="gwFoo_RowDataBound"
                    CssClass="customerDataTable" AllowSorting="True" 
                    onselectedindexchanged="gwOrderInvQuote_SelectedIndexChanged">
                    <Columns>

私がそのように宣言したテンプレートフィールド:

 <asp:TemplateField AccessibleHeaderText="fhfj">
            <HeaderTemplate> This is a Test </HeaderTemplate>
            <ItemTemplate> </ItemTemplate>
 </asp:TemplateField>

私が達成しようとしている効果は、ボタンをグリッドに完全に揃えることです。これまでの私の戦略は、このテンプレートフィールドを作成し、ヘッダーにを挿入して他のすべてのセルを空のままにすることです。列には他の目的はありません。グリッドに揃えられるようにボタンを収納します。

問題は、グリッドビューとテンプレートフィールドを使用するのはこれが初めてであり、空の列を作成できるかどうかを確認するためのこの簡単なテストでも機能しないことです。

4

1 に答える 1

1

csファイルでメソッドgwOrderInvQuote_SelectedIndexChangedを定義する必要があります。

 protected void gwOrderInvQuote_SelectedIndexChanged(object sender, EventArgs e)
 {
 // insert logic here
 }
于 2012-11-22T11:09:00.897 に答える