473,486 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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.
Nov 18 '05 #1
3 936
i think
Me.btnYesUpdate.Attributes.Add("OnClick", "ClosePopUp('txtQuantityOrder');")
is what i am looking for is that correct? thanks
"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:eX**************@tk2msftngp13.phx.gbl...
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.

Nov 18 '05 #2
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" <br**********@newsgroups.nospam> wrote in message
news:eX**************@tk2msftngp13.phx.gbl...
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.

Nov 18 '05 #3
"Brian Henry" <br**********@newsgroups.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.
Nov 18 '05 #4

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

Similar topics

5
3061
by: Vince C. | last post by:
Hi. I'd like to trap ADO Recordset object events in my ASP script (either VBS or JS, no preference). I've tried (in VBS) writing a Sub rs_RecordChangeComplete( adReason, cRecords, pError,...
4
1793
by: DC Gringo | last post by:
I have a clickable image that I would like to convert into a server control imagebutton accessing a server-side onClick event and a client-side javascript onclick event as well. Is this possible? ...
1
2826
by: Natalia DeBow | last post by:
Hi, I am working on a Windows-based client-server application. I am involved in the development of the remote client modules. I am using asynchronous delegates to obtain information from...
19
2441
by: Sjaakie Helderhorst | last post by:
Hello, I need to add a Javascript event (onClick) to a servercontrol (asp:checkbox). Checkbox is named 'cbDoMail'. Assumed that 'cbDoMail.Attributes.Add("onClick", "doJavascriptThing()") would do...
2
4311
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
12
2760
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
5
8484
by: Mark Rae | last post by:
Hi, Is it possible to add events, specifically a Click event, to a dynamically created TableCell? I have an <asp:Table...> control to which I'm dynamically adding TableRow controls made up of...
3
2026
by: Mike | last post by:
Hi, I'm wondering if I can do this with ASP.NET?
3
2788
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I...
0
7099
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
7175
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...
1
6842
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
7319
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...
1
4864
isladogs
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...
0
3069
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
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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
262
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.