Solved

C#

Posted on 2004-03-25
6
191 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-
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

624 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