473,408 Members | 2,888 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,408 software developers and data experts.

OnLeave event on a textbox?

ML
Hi NG,

Can anyone tell me how to create a OnLeave event on a regular textbox in an
ASP.NET webform? The only events I have available are: TextChanged, Disposed,
Init, Load, Prerender and Unload..

Thanks!

regards,

M.L.
Nov 19 '05 #1
6 12360
You can do it on client side with an onblur event. What do you want to do on
this event?

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:8D**********************************@microsof t.com...
Hi NG,

Can anyone tell me how to create a OnLeave event on a regular textbox in an ASP.NET webform? The only events I have available are: TextChanged, Disposed, Init, Load, Prerender and Unload..

Thanks!

regards,

M.L.

Nov 19 '05 #2
ML
Hi,

I want to disable another textbox in the same form if the user has entered
anything into the first box. The OnLeave is needed to determine whether this
is true. Like so:

private void TextBox1_OnLeave()
{
if (TextBox1.Text.Length > 0)
TextBox2.Enabled = false;
}

How can this be implemented?

Thanks!

"Eliyahu Goldin" wrote:
You can do it on client side with an onblur event. What do you want to do on
this event?

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:8D**********************************@microsof t.com...
Hi NG,

Can anyone tell me how to create a OnLeave event on a regular textbox in

an
ASP.NET webform? The only events I have available are: TextChanged,

Disposed,
Init, Load, Prerender and Unload..

Thanks!

regards,

M.L.


Nov 19 '05 #3
<asp:textbox id=TextBox1 ...
onblur="document.getElementById('TextBox2').disabl ed=(this.value=='')" ...

<asp:textbox id=TextBox2 ...

No server-side code is required.

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
Hi,

I want to disable another textbox in the same form if the user has entered
anything into the first box. The OnLeave is needed to determine whether this is true. Like so:

private void TextBox1_OnLeave()
{
if (TextBox1.Text.Length > 0)
TextBox2.Enabled = false;
}

How can this be implemented?

Thanks!

"Eliyahu Goldin" wrote:
You can do it on client side with an onblur event. What do you want to do on this event?

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:8D**********************************@microsof t.com...
Hi NG,

Can anyone tell me how to create a OnLeave event on a regular textbox
in an
ASP.NET webform? The only events I have available are: TextChanged,

Disposed,
Init, Load, Prerender and Unload..

Thanks!

regards,

M.L.


Nov 19 '05 #4
ML
Hi,

Thanks very much for the solution, but in fact I would prefer to do it
server-side.. Is this not possible?

"Eliyahu Goldin" wrote:
<asp:textbox id=TextBox1 ...
onblur="document.getElementById('TextBox2').disabl ed=(this.value=='')" ...

<asp:textbox id=TextBox2 ...

No server-side code is required.

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
Hi,

I want to disable another textbox in the same form if the user has entered
anything into the first box. The OnLeave is needed to determine whether

this
is true. Like so:

private void TextBox1_OnLeave()
{
if (TextBox1.Text.Length > 0)
TextBox2.Enabled = false;
}

How can this be implemented?

Thanks!

"Eliyahu Goldin" wrote:
You can do it on client side with an onblur event. What do you want to do on this event?

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:8D**********************************@microsof t.com...
> Hi NG,
>
> Can anyone tell me how to create a OnLeave event on a regular textbox in an
> ASP.NET webform? The only events I have available are: TextChanged,
Disposed,
> Init, Load, Prerender and Unload..
>
> Thanks!
>
> regards,
>
> M.L.


Nov 19 '05 #5
If the user enters something, you will get a server-side TextChanged event.
Is not it good for you?

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
Hi,

Thanks very much for the solution, but in fact I would prefer to do it
server-side.. Is this not possible?

"Eliyahu Goldin" wrote:
<asp:textbox id=TextBox1 ...
onblur="document.getElementById('TextBox2').disabl ed=(this.value=='')" ....
<asp:textbox id=TextBox2 ...

No server-side code is required.

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
Hi,

I want to disable another textbox in the same form if the user has entered anything into the first box. The OnLeave is needed to determine whether
this
is true. Like so:

private void TextBox1_OnLeave()
{
if (TextBox1.Text.Length > 0)
TextBox2.Enabled = false;
}

How can this be implemented?

Thanks!

"Eliyahu Goldin" wrote:

> You can do it on client side with an onblur event. What do you want
to do on
> this event?
>
> Eliyahu
>
> "ML" <ML@discussions.microsoft.com> wrote in message
> news:8D**********************************@microsof t.com...
> > Hi NG,
> >
> > Can anyone tell me how to create a OnLeave event on a regular
textbox in
> an
> > ASP.NET webform? The only events I have available are:

TextChanged, > Disposed,
> > Init, Load, Prerender and Unload..
> >
> > Thanks!
> >
> > regards,
> >
> > M.L.
>
>
>


Nov 19 '05 #6
No. This event happens on the client in the browser. The server is on the
othe rend of the wire - it has no idea that the user switched focus to a
different field.

You can trigger a postback to the server - but you would still need client
side code to trigger this. And then your page looks ugly because it keeps
flashing.

"ML" <ML@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
Hi,

Thanks very much for the solution, but in fact I would prefer to do it
server-side.. Is this not possible?

"Eliyahu Goldin" wrote:
<asp:textbox id=TextBox1 ...
onblur="document.getElementById('TextBox2').disabl ed=(this.value=='')"
...

<asp:textbox id=TextBox2 ...

No server-side code is required.

Eliyahu

"ML" <ML@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
> Hi,
>
> I want to disable another textbox in the same form if the user has
> entered
> anything into the first box. The OnLeave is needed to determine whether

this
> is true. Like so:
>
> private void TextBox1_OnLeave()
> {
> if (TextBox1.Text.Length > 0)
> TextBox2.Enabled = false;
> }
>
> How can this be implemented?
>
> Thanks!
>
> "Eliyahu Goldin" wrote:
>
> > You can do it on client side with an onblur event. What do you want
> > to

do on
> > this event?
> >
> > Eliyahu
> >
> > "ML" <ML@discussions.microsoft.com> wrote in message
> > news:8D**********************************@microsof t.com...
> > > Hi NG,
> > >
> > > Can anyone tell me how to create a OnLeave event on a regular
> > > textbox

in
> > an
> > > ASP.NET webform? The only events I have available are: TextChanged,
> > Disposed,
> > > Init, Load, Prerender and Unload..
> > >
> > > Thanks!
> > >
> > > regards,
> > >
> > > M.L.
> >
> >
> >


Nov 19 '05 #7

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

Similar topics

2
by: ross kerr | last post by:
Hi all, I have a control that extends the ComboBox object. It updates the selected item based on what the user enters in the text area. In the OnLeave event of the combobox, the selected...
3
by: Nic | last post by:
Hey, I have an ASP-application. In the ASPX I have an <asp:dropdownlist ..>. Now when I leave this control I want to initialisize some other fields. In window forms we uses the onleave event but...
2
by: Colin McGuire | last post by:
Hi, I have a child form - when the mouse is over the button on the parent form, I show the child form. When the mouse cursor is moved away from the button, I hide the child form. My child form...
8
by: Martin | last post by:
Hi all, I'm trying to make a subclass of the Textbox. One of the things I did there is the following: Protected Overrides Sub OnLeave(ByVal e As System.EventArgs) If Me.DataType = 1 Or...
1
by: Ben Fidge | last post by:
Our customers want to pop-up a small survey when their users have finished browsing their site. To the best of my knowledge, I don't think this is even possible. Can anyone confirm this or,...
5
by: rn5a | last post by:
Consider the following user control which resides in Address.ascx: <script runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String)...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
3
by: Mecena | last post by:
I have an annoying issue with a simple textbox control. I'm trying to catch the TAB key with KeyUp (nothing else works), but for some reason as soon as I hit it (before KeyUp!), OnLeave fires and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
0
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
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...

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.