C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

to make default button


Posted Date: 04 Jul 2008      Posted By: bill      Member Level: Gold     Points: 1   Responses: 2



when there are two buttons in a webpage.how to make the loginbutton of login control (which is one those buttons) default i.e. when we press enter key,the loginbutton works?




Responses

Author: Sujit Kumar    04 Jul 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 4

there are two methods to set defalut button in asp.net
1>
<form id="form1" runat="server" defaultbutton="btn1">

2>
txtPassword.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('" + LoginButton.UniqueID + "','')");


I would prefer first method.



Author: Payal Jain    04 Jul 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 6

<form defaultbutton="button1" runat="server">
<asp:textbox id="textbox1" runat="server"/>
<asp:textbox id="textbox2" runat="server"/>
<asp:button id="button1" text="Button1" runat="server"/>

<asp:panel defaultbutton="button2" runat="server">
<asp:textbox id="textbox3" runat="server"/>
<asp:button id="button2" runat="server"/>
</asp:panel>

</form>



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : which is more adviseable for taking crush course, is it vb.net or c#.net
Previous : how to insert
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use