Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 24th, 2014, 04:21 PM
Authorized User
Points: 416, Level: 7
Points: 416, Level: 7 Points: 416, Level: 7 Points: 416, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default Ch 16 Putting the cursor in the Login control

Hi Imar,

I couldn't find in the book how to make the cursor automatically show up in the User Name text box for the Login control.

I tried setting the TabIndex = 1, but the cursor still doesn't start in that location.

Is there another issue at work here?

Thanks.

Best Regards,
Alan
 
Old February 24th, 2014, 04:38 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alan,

Take a look here: http://msdn.microsoft.com/en-us/library/ms178232.aspx

For the Login control, this is a bit trickier as you don't have direct access to the text box control. The easiest solution is to convert it to a Template using the Smart Tasks panel.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old February 24th, 2014, 04:44 PM
Authorized User
Points: 416, Level: 7
Points: 416, Level: 7 Points: 416, Level: 7 Points: 416, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default

Hi Imar,

I'm sorry for the 'asked' and then 'answered before you got to it' post. I just needed to be a little more patient. Just after I posted I found someone who provided what I think is a brilliant solution:


In the code behind:
Code:
  Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

    Page.Form.DefaultFocus = LoginView1.FindControl("Login1").ClientID

  End Sub
I understand the whole command except for the end, 'ClientID'. Would you be able to explain that part of the code?

You may also have some advice that all of us would want to consider for why a different way would be better.

Thanks.

Best Regards,
Alan
 
Old February 24th, 2014, 04:46 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

ClientID returns the id of the control at the client (in the HTML) which is needed to set the focus (as that all happens on the client side).

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
AlanWheeler (February 24th, 2014)
 
Old February 24th, 2014, 04:46 PM
Authorized User
Points: 416, Level: 7
Points: 416, Level: 7 Points: 416, Level: 7 Points: 416, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default

I guess we 'crossed in the night' with our posts.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 16 Login Controls AlanWheeler BOOK: Beginning ASP.NET 4.5 : in C# and VB 3 February 24th, 2014 04:58 PM
Ch 16: Login control not logging in jMarvin BOOK: Beginning ASP.NET 4 : in C# and VB 2 November 19th, 2011 02:00 PM
Search ch 13, ch 16 sporik BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 0 October 27th, 2009 04:44 PM
Putting a dynamic chart and the dropdown control the drives it on the same page StevenF ASP.NET 3.5 Basics 0 April 25th, 2009 06:46 AM
Unable to set image or cursor property, Ch 12. VictorVictor BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 5 April 26th, 2006 10:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.