Solved

C#

Posted on 2004-03-25
6
190 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

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 …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

734 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