473,498 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object Focus

I have two TextBoxes so a user can enter a start and end date using a
calendar control. I am using the <Calendar1_SelectionChangedmethod to input
the date in the textbox. My question is this: Is there a way to determine
which textbox has focus so when the the user clicks on a date in the calendar
control, the date selected is inputted into the textbox with focus? Below is
code that I am using.
private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
if(txtStartDate.Text == "")
txtStartDate.Text = Calendar1.SelectedDate.ToShortDateString();

else
txtEndDate.Text = Calendar1.SelectedDate.ToShortDateString();
}

Jul 6 '06 #1
1 1075
in javascript, you could use the onblur event to figure out which
textbox they were in last.
Joseph wrote:
I have two TextBoxes so a user can enter a start and end date using a
calendar control. I am using the <Calendar1_SelectionChangedmethod to input
the date in the textbox. My question is this: Is there a way to determine
which textbox has focus so when the the user clicks on a date in the calendar
control, the date selected is inputted into the textbox with focus? Below is
code that I am using.
private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
if(txtStartDate.Text == "")
txtStartDate.Text = Calendar1.SelectedDate.ToShortDateString();

else
txtEndDate.Text = Calendar1.SelectedDate.ToShortDateString();
}
Jul 6 '06 #2

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

Similar topics

2
2794
by: Wai Man Chung | last post by:
Dear all, I have an asp page which upon opening a field will be set to be in focus so that user can type in data without the need to use the mouse to click on the field. However, after I add...
2
7717
by: Paul Thompson | last post by:
I am trying to use various javascript tools, all of which work in NN, to work in IE. Here's my latest annoyance. I get a list of all objects on a page using docContents =...
1
2264
by: TAM | last post by:
Hi, I have a simple JavaScript code that ensures that all the form fields are filled and there is also a function that checks if the email is a valid address. For some reason IE is giving...
3
2230
by: Gidi | last post by:
Hi, Is it possible to know when TextBox loses focus to which object it lost it? what i mean is when the LostFocus Event occur is it possible to know which object got the focus instead? thanks,
0
1714
by: Patrick | last post by:
This is a C# post. I'm using VB.NET to create an add-in for the Google Sidebar, and have implemented the OnDetailsView method. NOTE : I've come across this same problem (error message) even in...
8
1402
by: psema4 | last post by:
Hi all, I've spent several days trying to work this out. Maybe I'm just searching for the wrong keywords/phrases. I have some code that looks like: Console = new Object(); Console.init...
0
1329
by: Specterman | last post by:
Colin, thank you for your posts on this subject. It helped me to solve a similar problem I was having. I'm designing a form that will let the user select an Excel file to embed. It appears that...
4
1315
by: tshad | last post by:
I have an object surrounded by <div visible=false runat="server"></div>. So it doesn't show on the page until I set visible=true. I need to set focus to the object on post back: if not...
1
3034
by: finditajr | last post by:
Hello I'm having the following problem: My main webpage calls a function stored in a .js file that creates an HTML window to display a calendar. Whenever I click on a date in that calendar,...
275
12025
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
7125
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
7165
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,...
1
6887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
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
5462
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,...
0
3093
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...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
291
bsmnconsultancy
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...

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.