iJade
iJade

Reputation: 23801

Default button on master page also working for content pages

I have a form on master page

 <form id="form1" runat="server" defaultbutton="ibnQuickSubmit" defaultfocus="txtQuickSearch">
 <asp:TextBox ID="txtQuickSearch" runat="server"></asp:TextBox>
 <asp:ImageButton ID="ibnQuickSubmit" runat="server" OnClick="ibnQuickSubmit_Click"
                                ImageUrl="~/Images_v4/Common/Go.png" />
  </form>

I have set the above button ibnQuickSubmit as default button on enter key press when defaultfocus="txtQuickSearch" It works fine but when i click on any other text box on any content page and press enter, in dat condition also the default key press of master page works. Can any one throw some pointer about what is going wrong.

Upvotes: 0

Views: 483

Answers (1)

Amol
Amol

Reputation: 1461

you can do that using Panel

<asp:Panel id="form1" runat="server" DefaultButton="ibnQuickSubmit">

 // Some controls and code //

 <asp:TextBox ID="txtQuickSearch" runat="server"></asp:TextBox>
 <asp:ImageButton ID="ibnQuickSubmit" runat="server" OnClick="ibnQuickSubmit_Click"
                            ImageUrl="~/Images_v4/Common/Go.png" />

 // Some controls and code //

</asp:Panel>

Upvotes: 1

Related Questions