Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set focus in MVC application
Message
From
03/02/2010 13:57:41
 
 
To
03/02/2010 13:46:48
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
ASP.NET
Category:
MVC
Miscellaneous
Thread ID:
01447329
Message ID:
01447332
Views:
41
>I have a ASP.Net MVC application. How can I set focus to a textbox in a aspx form?

I am not sure if this applies to MVC, but in ASP.NET, I do it like this:
            ' If we have to set the focus on a control
            If cFocus.Length > 0 Then
                loControlTextbox = oProcess.oPage.FindControl(cFocus)
                loControlTextbox.Focus()
            End If
Basically, I have added a cFocus property in my DataEntry class. If it is set, when the form is being generated, it will find the control and set the focus to it.

oProcess.oPage is simply a reference in my framework to the page. You might need to adjust that.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform