Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.NET Default Button

Posted on 2007-12-03
3
Medium Priority
?
193 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 2000 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

916 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