Solved

C#

Posted on 2004-03-25
6
186 Views
Last Modified: 2010-04-06
What is the C# or ASP equivilant of the javascript.Focus command?
Thanks in advance.
_oTtAw-
0
Comment
Question by:_oTtAw-
6 Comments
 
LVL 17

Accepted Solution

by:
dorward earned 50 total points
ID: 10682374
Any such command would depend on your graphical toolkit library.

Assuming you are talking about server side C# and ASP - there is no such equivilant.

The server side code doesn't present a user interface, it outputs (usually) HTML (often with CSS and/or JavaScript).

The outputted JavaScript could call element.focus() onload. e.g.

... %>

<script type="text/javascript">
window.onload = function () { document.getElementById('id-of-element').focus(); }
</script>

<% ...
0
 

Assisted Solution

by:Sharbel99
Sharbel99 earned 50 total points
ID: 10683603
The closest you will come to it would be to use the RegisterStartupScript in your Page_Load  to set focus to the control you want.  However, you could just as easily do it in the HTML itself.  You have to understand that ASP and ASP.NET are server technologies, and thus all your programming is executed on the server.

So if you need to do it programmatically in your Server script, use the RegisterStartupScript to set focus to the control you want, other than that, use Javascript as its a client side function.
0
 

Expert Comment

by:leebee300
ID: 10685571
you cant do it
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

708 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

14 Experts available now in Live!

Get 1:1 Help Now