Solved

ASP.NET Default Button

Posted on 2007-12-03
3
184 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now