ASP.NET Master page DefaultButton override

拟墨画扇 提交于 2019-12-03 04:52:32

Use UniqueId. Since you can have multiple server controls with the same server id, ie, in a GridView, the framework needs to the unique id to match up to.

this.Form.DefaultButton = this.ibRecalc.UniqueID;

You could try using the "DefaultButton" property of a Panel...

Place your button or whole page or div in asp:Panel

// start panel

asp:Panel ID="pnlOpsCallSummay" runat="server" DefaultButton="btnSearch"

............

//Controls of your requirement

..........

asp:Button ID="btnSearch" runat="server" Text="Search"

close the pannel

No need of Overriding the master page button

If you move the panel inside the login's template:-

<asp:login id="Login2" runat="server" loginbuttontype="Image">
<layouttemplate>
   <asp:`enter code here`panel id="Panel1"   runat="\
     server"defaultbutton="LoginImageButton">
   </asp:Panel>
 </LayoutTemplate>
</asp:Login>

Then it will work without code. You can set loginbuttontype="Image" or Link or button according to your requirement.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!