473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

script focus example

I am using script for Focus to txtAdi which is textbox in c# web
application.But it doesnt work.

Have you any idea why it doesnt work.What must I do ? can you give me
example.
Because I am beginner in c# asp.net

thanks.......

char c=(char)34;

string script =

"<script language=" + c + "javascript" + c

+ ">" +

" var control = document.getElementById(" + c +

txtAdi + c + ");" +

" if( control != null ){control.focus();}" +

"</script>";

Page.RegisterStartupScript("Focus", script);

Nov 15 '05 #1
2 1441
Adding this somewhere in the html page (I put it after </form>) should set
focus to a control named txtAdi

<script language=javascript>
document.forms[0].item("txtAdi",0).focus();
</script>

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode and Nostalgia enabled
Nov 15 '05 #2
Btw, there is no reason to add char c = (char)34;
You can use \"

string script = "<script language=\"javascript\">" +
" var control = document.getElementById(\"txtAdi\");" +
" </script>";

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode and Nostalgia enabled
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Kenneth | last post by:
Hello, I'm having some serious problems debugging a script that I'm trying to make work. I'm working on a form where a user can type in a time (in the format of HH:MM), and another script...
2
by: Dennis | last post by:
This may be easy for most but I can't get this thing to work. I believe I followed all the instructions but when I click on the link no window opens just the default IE page cannot display. Here is...
1
by: Luis | last post by:
When I run the following script it displays a form with a dropdown list and four text boxes. If I select "No" from the dropdown list all the text boxes are disabled. If I select "Yes" from the...
4
by: Semi Head | last post by:
Hello folks, I'm looking for a script to validate a specific number value in a standard form input field. An example would be, if someone enters a number into a form input, I want the script to...
7
by: selen | last post by:
I am using above script for Focus to txtAdi which is textbox in c# web application.But it doesnt work. Have you any idea why it doesnt work thanks....... char c=(char)34;
2
by: kpg | last post by:
Hi all, This should be simple... I have a TextBox1 and a customvalidation control linked to it. I use a client side script to validate the textbox. If the data is not valid I want to return...
2
by: Paul | last post by:
Hi I have some code and java script, when the page initially loads I want it to have focus on dr_tx_names. This works. The page loads a second time with a dropdown selection and in the code...
1
by: RSH | last post by:
I have a situation where I am Registering a Startup script with the following code: If Not IsPostBack Then Dim sScript As StringBuilder = New StringBuilder sScript.Append("<SCRIPT...
4
by: happyse27 | last post by:
Hi All, The html page(see item a below) is calling javascript(item b below), but cant work as the page show blank. Not sure if the method of calling is wrong(in terms of default directory) or...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.