Link to home
Start Free TrialLog in
Avatar of doramail05
doramail05Flag for Malaysia

asked on set default button (enter) as user's control btnLogin

trying to set login button (Button1) in user control as default button in the page default.aspx

<asp:Button ID="Button1" runat="server" Text="Login" OnClick="Button1_Click" CssClass="mainbutton" />

Open in new window

Avatar of ong-hh

Avatar of Rahul Agarwal
just put this property in your form tag (in aspx page):


 your form tag looks something like this:

<form id="form1" runat="server" defaultbutton="Button1">
Hi, Use this javascript for set default button

function clickButton(e, buttonid)
var bt = document.getElementById(buttonid);
if (typeof bt == 'object'){
if (e.keyCode == 13){;
return false;
if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
if (event.keyCode == 13){;
return false;
Can u set the UseSubmitBehavior=true to the button in the usercontrol and check.
hello doramail05!!

I think i got a better solution fr tht as default button technique won't help !!

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub

to find client ID you just need to drag the LoginBox.ascx in aspx page and see the source code of the page. there u will find the client id (ID) generated for the login button which you want to set as default.
Avatar of doramail05
Flag of Malaysia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of doramail05


solved already from other post/forum