473,395 Members | 1,502 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,395 software developers and data experts.

To focus textbox after dropdown selected

Hi ,

I am facing one different problem.

I have dropdown and textbox.

After i selected drop down textbox should focus.

But its disabled and not focussing......

i am calling this function to set focus WtxtLDescription on dropdown selected by
ClientScript.RegisterStartupScript(GetType(), "script1",
"<script language='javascript'>setFocus('E');</script>");


function setFocus(mode)
{
if(mode=='E')
{

document.getElementById("WtxtSDescription").classN ame = "viewbox";
document.getElementById("WtxtSDescription").readOn ly = true;
}
else
{
document.getElementById("WtxtLDescription").focus( );
document.getElementById("WtxtSDescription").readOn ly = false;
document.getElementById("WtxtSDescription").classN ame = "text";
}
}

Please suggest me
Jul 9 '07 #1
2 1681
shweta123
692 Expert 512MB
Hi,

Try to make textBox Enabled first and then set the focus on it.

document.getElementById("WtxtSDescription").readOn ly = false;
document.getElementById("WtxtLDescription").focus( );
Jul 9 '07 #2
Plater
7,872 Expert 4TB
Yeah, disabled controls cannot receive focus, you will have to enable it first.
(If you are worried about users modifying the contents, most controls have some form of ReadOnly mode)
Hi,

Try to make textBox Enabled first and then set the focus on it.

document.getElementById("WtxtSDescription").readOn ly = false;
document.getElementById("WtxtLDescription").focus( );
Jul 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Christian Ista | last post by:
Hello, I have 2 questions : 1. On an ASP.NET page I have several controls (5 TextBox, 1 Dropdown and 1 button) Only the dropdown is AutoPostBack = true, the TextBox are SingleLine When I...
3
by: BK | last post by:
I've created a small calculator that will pop up on demand within a form. The calculator is working fine, but I'm having a focus problem. The calculator looks almost identical to the Windows...
3
by: Henry Jones | last post by:
VS 2005 On a form I have a tabcontrol with 5 tabs. Each tab has three textboxes on it. When I click on each tab, I would like to have the focus set to the first textbox. On the tabenter...
1
by: Werner Schmidt | last post by:
Dear group, I have a very strange behaviour: In a loop there are several TextBoxes initialized: TextBox objTextBox = null; // one declaration for-loop // multiple initialisations
2
by: wildman | last post by:
RE: Gridview textbox has data check without postback.. javascript? I have a gridview with a textbox. I can set the textbox to autopostback and check for a value in a prerender event to decide if...
2
by: manishamca | last post by:
In dropdown i am retriving value from the backend. For eg: in the dropdown list the value selected are employee id..then i want to disply the emp name,job etc in the textbox. If i select a...
1
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi all! I have a tab control and when I access a tab page I'd like to focus on a textbox. I am using someTextBox.Focus() on tabPage_Enter() event, but it is not focusing in the someTextBox. ...
11
by: slinky | last post by:
I'm trying to simply set the focus of "txtUserName" upon opening this login form. I put in some Javascript but it is not working. Any ideas? Thanks! <%@ Page Language="vb"...
10
by: Derek Hart | last post by:
I can set focus to my property grid by using propgrid.Focus - but how can I set the default property that is always first? Or just set focus to the default property? Can this be done?
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.