Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > adding events to a client side control in asp.net code

Reply
Thread Tools

adding events to a client side control in asp.net code

 
 
Brian Henry
Guest
Posts: n/a
 
      08-02-2004
How can i in the code behind add an OnClick even to a text box which is also
a server side control, so when the user on the client side clicks it, it
performs that VB script or JavaScript action? thanks... i thought there was
some kind of event registration for stuff like this but i completely forgot
what it was.


 
Reply With Quote
 
 
 
 
Brian Henry
Guest
Posts: n/a
 
      08-02-2004
i think
Me.btnYesUpdate.Attributes.Add("OnClick", "ClosePopUp('txtQuantityOrder');")
is what i am looking for is that correct? thanks


"Brian Henry" <> wrote in message
news:...
> How can i in the code behind add an OnClick even to a text box which is

also
> a server side control, so when the user on the client side clicks it, it
> performs that VB script or JavaScript action? thanks... i thought there

was
> some kind of event registration for stuff like this but i completely

forgot
> what it was.
>
>



 
Reply With Quote
 
 
 
 
Matt Fischer
Guest
Posts: n/a
 
      08-02-2004
You can use the following in your server code to add an event:

textboxname.attributes.Add("onclick", "myjavascriptaction();")

Something else, if your control is a button or other control that has a
related server side action, you should modify it to include the foloowing as
well:

button.attributes.Add("onclick", "myjavascriptaction();return
true;")






"Brian Henry" <> wrote in message
news:...
> How can i in the code behind add an OnClick even to a text box which is

also
> a server side control, so when the user on the client side clicks it, it
> performs that VB script or JavaScript action? thanks... i thought there

was
> some kind of event registration for stuff like this but i completely

forgot
> what it was.
>
>



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      08-02-2004
"Brian Henry" <> wrote in message
news:%...
> i think
> Me.btnYesUpdate.Attributes.Add("OnClick",

"ClosePopUp('txtQuantityOrder');")
> is what i am looking for is that correct? thanks


That looks about right. I can't be 100% on the code, but Attributes is
certainly the way to do it.


 
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
How to execute client-side code _after_ client-side validation? Bogdan ASP .Net 2 06-09-2008 01:31 PM
Adding Server Side code in a Client Side Script??? =?Utf-8?B?TWlrZSBSYW5k?= ASP .Net 1 01-30-2006 08:52 PM
Problem in adding template of server side control using client side scripts Lau Lei Cheong ASP .Net 1 10-13-2004 10:41 AM
client side vs server side events for controls Mong ASP .Net 5 05-07-2004 01:20 PM
Adding custom client-side onClick handler with client-side validator controls Zoe Hart ASP .Net Web Controls 1 01-08-2004 10:45 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57