DefaultButton を持つ Panel を持つページに GridView コントロールがあります。ユーザーが行を編集するときに、「更新」ボタンを Enter キーで操作できるようにしようとしています。マウスで問題なく動作します。「更新」をクリックすると、行が表示モードに戻り、更新された値が表示されます。
GridView がパネルにある場合、RowCommand が処理される前に Enter キーを押すと、パネルの既定のボタン (ページを送信するボタン) が起動し、更新が失われます。
GridView がパネルにない場合、パネル内の一見ランダムなボタンが起動しますが、行の EditItemTemplate の「更新」ボタンは起動しません。具体的には、ページに CalendarExtender があり、エクステンダーのポップアップ ボタンが起動します。私が望むものではありません。
これを正しく動作させるにはどうすればよいですか?
私のマークアップコードの構造は次のとおりです。
<asp:Panel ID="Panel1" runat="server" DefaultButton="btnSubmit">
<!--Form with controls-->
<asp:ImageButton ID="btnWSPODateCal" runat="server" />
<!--this button fires when I press enter while editing a grid row:-->
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server"
TargetControlID="tbPODate" PopupButtonID="btnWSPODateCal" />
<!--more controls-->
<div class="button_row">
<asp:ImageButton ID="btnCancel" runat="server" />
<asp:ImageButton ID="btnSubmit" OnClick="btnSubmit_Click" />
</div>
</asp:Panel>
<asp:GridView runat="server">
<Columns>
<asp:TemplateField>
<EditItemTemplate>
<asp:ImageButton CommandName="MyUpdate"
ID="btnSubmitRow" runat="server"
CommandArgument="<%# ((GridViewRow) Container).DataItemIndex %>" />