Spooks
Spooks

Reputation: 7177

defaultbutton is not working on my first panel, but works well with the rest of them?

I have a search panel in my master page, which seems to be getting called when typing in another panel and hitting enter, even though the panel has a different defaultButton. The weird thing is the second and third panels work well, which ever one I put at the top calls the search button.

My search panel in my master page

  <asp:Panel runat="server" ID="pnlSearch" DefaultButton="btnSearch">
        <asp:TextBox ID="txtSearch" CssClass="fld" runat="server" Width="160" Text="Search..."
            onclick="this.value='';" CausesValidation="false"></asp:TextBox>
        <asp:ImageButton ID="btnSearch" ImageUrl="~/Images/search_arrow.gif" runat="server"
            OnClick="btnSearch_Click" CausesValidation="false" />
    </asp:Panel>

and my other panels inside a control(only displaying two, the first one calls btnSearch, but the second one works fine.

 <asp:Panel DefaultButton="btnViewPage" ID="pnlViewPage" runat="server" CssClass="floatLeft">
            <table>
                <tr class="adminRow">
                    <td class="adminLeftCol">
                        View Page:
                    </td>
                    <td>
                        <asp:TextBox ID="txtViewPage" Width="35px" runat="server"></asp:TextBox>
                    </td>
                    <td class="adminRightCol">
                        <asp:ImageButton ID="btnViewPage" runat="server" Text="Go" Width="75%" ImageUrl="~/Images/search_arrow.gif"
                            OnClick="btnViewPage_Click" ImageAlign="AbsBottom" CausesValidation="false" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <asp:Panel DefaultButton="btnEditpage" ID="pn1Edit" runat="server" CssClass="floatLeft">
            <table width="100%">
                <tr class="adminRow">
                    <td class="adminLeftCol">
                        Edit Page:
                    </td>
                    <td>
                        <asp:TextBox ID="txtEditPage" Width="35px" runat="server"></asp:TextBox>
                    </td>
                    <td class="adminRightCol">
                        <asp:ImageButton ID="btnEditpage" runat="server" Text="Go" Width="75%" ImageUrl="~/Images/search_arrow.gif"
                            OnClick="btnEditpage_Click" ImageAlign="AbsBottom" CausesValidation="false" />
                    </td>
                </tr>
            </table>
        </asp:Panel>

Upvotes: 0

Views: 1195

Answers (1)

Tobiasopdenbrouw
Tobiasopdenbrouw

Reputation: 14039

I've seen cases where the panel had to be inside an actual TD (the defaultbutton had to be a direct inner element of the panel). Have you tried this / can you try this?

Upvotes: 2

Related Questions