Solved

ASP.NET Default Button

Posted on 2007-12-03
3
188 Views
Last Modified: 2013-11-26
I have a home.aspx page that loads controls based on Request.Params

The Case statement in the Master Page is

 Select Case CStr(Request.Params("page"))
            Case "home" --------------------
A bunch of case statements
---------------------------

Case Else
                Session("info") = " Home Page"
                Dim uc As UserControl = CType(LoadControl("includes/login.ascx"), UserControl)
                uc.ID = "uc99"
                ContentPlaceHolder1.Controls.Add(uc)
End Select

includes/login.ascx has this button
<asp:ImageButton ID="ImageButton1" src="images/btnLogin.jpg" runat="server" TabIndex="1"  />

How do I make that the default if someone just hits the enter key?

Open in new window

0
Comment
Question by:lrbrister
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
newyuppie earned 500 total points
ID: 20400890
in the load event of the page put the following in the first line:

Page.Form.DefaultButton = ImageButton1.UniqueID

Hope it helps
NY
0
 

Author Closing Comment

by:lrbrister
ID: 31412521
Excellent...to the point...and right on time.  With a code example.  Some of the experts could take a lesson from this answer.  Great job newyuppie.
0
 
LVL 13

Expert Comment

by:newyuppie
ID: 20401000
thank you for the kind comments. im glad it helped you. cheers
NY
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question