Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > OnLeave event on a textbox?

Reply
Thread Tools

OnLeave event on a textbox?

 
 
=?Utf-8?B?TUw=?=
Guest
Posts: n/a
 
      09-27-2005
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.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TUw=?=
Guest
Posts: n/a
 
      09-27-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.

>
>
>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TUw=?=
Guest
Posts: n/a
 
      09-27-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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.
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      09-27-2005
You can do it on client side with an onblur event. What do you want to do on
this event?

Eliyahu

"ML" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      09-27-2005
<asp:textbox id=TextBox1 ...
onblur="document.getElementById('TextBox2').disabl ed=(this.value=='')" ...

<asp:textbox id=TextBox2 ...

No server-side code is required.

Eliyahu

"ML" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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.

> >
> >
> >



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      09-27-2005
If the user enters something, you will get a server-side TextChanged event.
Is not it good for you?

Eliyahu

"ML" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > 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.
> > > >
> > > >
> > > >

> >
> >
> >



 
Reply With Quote
 
Marina
Guest
Posts: n/a
 
      09-27-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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" <(E-Mail Removed)> wrote in message
>> > > news:(E-Mail Removed)...
>> > > > 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.
>> > >
>> > >
>> > >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a client-side OnLeave event for a page? =?Utf-8?B?QmVuIEZpZGdl?= ASP .Net 1 02-13-2006 12:26 PM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
PreRender Event occurs immediatley after Load event =?Utf-8?B?QWxpcmV6YSBaaWFp?= ASP .Net 1 02-09-2004 10:19 AM
Event On Form From Control Event Dave Wurtz ASP .Net 1 12-09-2003 10:37 PM
onleave? Thomas Henz HTML 11 09-08-2003 03:24 PM



Advertisments