Hi,
I am showing/hiding a variety of panels that have different text boxes via
code-behind functions. Depending on the condition, I would like to have the
focus be set on a specific text box. However, all examples I've seen do
this from the client side.
Does anyone have a way to easily to specify the textbox to focus on from a
code-behind function? My guess is it will have to be some combination of
server-side and client-side coding.
Any help would be appreciated.
Thanks!
-- Kent Iler
---------------------------------------------------------------------- ke**@iler.NOSPA M.com
Please CC: all replies via e-mail
Remove .NOSPAM from e-mail address 4 4817
HI Kent P. Iler ,
The followint function will helps you to set the focus to the
specified control through the Code behind.
Only the thig you have to pass the Control name as string Parameter
ex : SetAlertFocusCo ntrol("txtName" )
Not you can place the focus to all the Control With this generic function.
Public Sub SetAlertFocusCo ntrol(ByVal ControlName As String)
Dim strScript As String ' for storing the script generated
Try
strScript = "<script language=" + Chr(34) + "javascript " + Chr(34) + ">"
strScript &= " var control = document.getEle mentById(" + Chr(34)
strScript &= ControlName + Chr(34) + ");"
strScript &= " control.focus() ;"
strScript &= "</script>"
' register the generated script
Page.RegisterSt artupScript("Fo cus", strScript)
Catch excp As Exception
Finally
End Try
End Sub
Hope this helps ! all the best
--
Message posted via http://www.dotnetmonster.com
Hi Kent,
Yeah you can bring to the focus to some controls based on some condition. I
believe you know how to bring the focus to a control using java script. What
you need to do here is make that script to trigger from the code behind file.
There are two ways to running the script from the code behind file.
1. Printing the script using response.write.
eg. Response.Write( "<script>text1. focus()</script>")
2. Using Page.RegisterSt artupScript
Page.RegisterSt artupScript("fo c", "text1.focus()" )
Page.RegisterSt artupScript will execute the script.
With regards,
Sadha Sivam S,
Microsoft Community Star,
Sr. Software Engineer,
Aspire Systems, www.dotnetspider.com
"Kent P. Iler" wrote: Hi,
I am showing/hiding a variety of panels that have different text boxes via code-behind functions. Depending on the condition, I would like to have the focus be set on a specific text box. However, all examples I've seen do this from the client side.
Does anyone have a way to easily to specify the textbox to focus on from a code-behind function? My guess is it will have to be some combination of server-side and client-side coding.
Any help would be appreciated.
Thanks!
-- Kent Iler ---------------------------------------------------------------------- ke**@iler.NOSPA M.com Please CC: all replies via e-mail Remove .NOSPAM from e-mail address
Something basic like this should work:
Response.Write "<script language = javascript>"& MyTextBox.Clien tID &
".focus()</script>"
Here is an even slicker approach: http://SteveOrr.net/faq/2in1.aspx
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://Steve.Orr.net
"Kent P. Iler" <ke**@iler.NOSP AM.com> wrote in message
news:Nr******** ************@co mcast.com... Hi,
I am showing/hiding a variety of panels that have different text boxes via code-behind functions. Depending on the condition, I would like to have the focus be set on a specific text box. However, all examples I've seen do this from the client side.
Does anyone have a way to easily to specify the textbox to focus on from a code-behind function? My guess is it will have to be some combination of server-side and client-side coding.
Any help would be appreciated.
Thanks!
-- Kent Iler ---------------------------------------------------------------------- ke**@iler.NOSPA M.com Please CC: all replies via e-mail Remove .NOSPAM from e-mail address
Hi Kent,
You can make use form Data Format string property of the grid columns to
format the date.
For more input Refer http://www.dotnetspider.com/technology/kbpages/384.aspx.
With regards,
Sadha Sivam S,
Microsoft Community Star,
Sr. Engineer,
Aspire Systems, www.dotnetspider.com
"Kent P. Iler" wrote: Hi,
I am showing/hiding a variety of panels that have different text boxes via code-behind functions. Depending on the condition, I would like to have the focus be set on a specific text box. However, all examples I've seen do this from the client side.
Does anyone have a way to easily to specify the textbox to focus on from a code-behind function? My guess is it will have to be some combination of server-side and client-side coding.
Any help would be appreciated.
Thanks!
-- Kent Iler ---------------------------------------------------------------------- ke**@iler.NOSPA M.com Please CC: all replies via e-mail Remove .NOSPAM from e-mail address This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: titouille |
last post by:
Hi everybody !
first, sorry for my poor english, I'm french mothertongue ;)
technologies :
--------------
Python 2.3
Twisted Matrix 1.2.0
wxPython 2.5.1
|
by: dsnyder |
last post by:
This HTML has a bit of Javascript at the end that puts the initial
focus on the userID field. It works great on Windows2000 running IE6,
but the initial focus never goes to the userID field on Windows 2003
PocketPC (Windows Mobile) running Pocket IE.
<html><head><title>WMS - P280WF100 - Login</title><META
HTTP-EQUIV='expires' VALUE='0'>
</head>
<body>
<form name="frmLogon" action='p280wp100' method='get'>
|
by: Benno Bös |
last post by:
If I use the following construct in the frame "main" for a link to an
extern site:
<A HREF="http://www.any.xy" TARGET="extern">
the Browser is creating the window "extern", loading the page
www.any.xy an setting the focus to "extern". But when I go return to
"main" without closing "extern", a click to an other link (e.g.
www.2nd_any.xy) on "main" does not setting the focus to "extern".
|
by: Jim Bayers |
last post by:
This has been driving me crazy. server.transfer doesn't set the focus
to the page I transfer to so when the user does a refresh, the results
aren't what's expected.
I have a datagrid on one page that lists the student's guests. At the
bottom of the datagrid is an 'add a new guest' button. Users click on
this button an it takes them to a new page where they can add a new
guest. So they type in the guest information and click on the...
|
by: copyco |
last post by:
I want to be able to test if my app's form has focus, (ie: not in
background, behind other windows). How can I do this? I tried the
Me.Focused, but that doesn't work. I think it's because a control
within the form actually has focus, so the Me.Focused would return
false. Thanks!
| |
by: Raja S. |
last post by:
How does one set the initial focus to a control such as a picture box?
Suppose I have a form with a single picture box on it.
When the application starts to run I would like to set the focus to the
picture box so that it can respond to KeyDown events.
I tried placing a picBox.focus in a Form_load event handler but that didn't
seem to help.
Any suggestions?
|
by: James Pyrich |
last post by:
Greetings:
I am using .NET to pop up a graphical window for a legacy application
(remember the IBM System/23?). In order to achieve good performance, I
created a GUI Broker Server and a Client Stub. The Client just uses the
Win32 API and is very fast. The Server runs in the background, using .NET
(thus eliminating the startup time for an individual application).
The performance is very good, no problems there. However, I am having...
|
by: Benton |
last post by:
Hi there,
I was using VS 2005 Beta 2 and was able to set the focus to any control on a
web form by calling its Focus() method, for instance:
btnContinue.Focus();
Today I upgraded to VS 2005 RTM and now I get an exception at runtime when
the code execution reaches the above line. The exception I get is this:
|
by: rameshch45 |
last post by:
How to set the initial focus on the cursor in my form's first field? I dont want to use javascript for that as I have many forms - is there any attribute to set?
|
by: =?ISO-8859-15?Q?Albe_V=B0?= |
last post by:
In my Application, I need to make a certain graphical refresh,
interrogating SqlServer, only if Application has focus (i.e. the title
bar is blue).
Interrogating .Focused property of various forms of the project is not
the way (maybe, enumerting forms and checking if at least one of them
has focus may work, but I don't think this to be the most beautiful
solution).
Any idea?
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |