473,799 Members | 3,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create an event

Hi,

I create a WEB application and I use a textbox, server control.
It does not have an OnClick event. Is it possible to create one?

Thanks
Oct 11 '06 #1
4 1669
Explain how you would use a textbox that would trigger a server
side postback on the onclick event?

Once you clicked inside the textbox each time, it would post
back to the server.

How would you ever use something like that?

You can add html client side events by adding to
the .Attributes collection of the control though.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp

"Dan Aldean" <do*******@roge rs.comwrote in message
news:O0******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

I create a WEB application and I use a textbox, server control.
It does not have an OnClick event. Is it possible to create one?

Thanks

Oct 11 '06 #2
Hi Dan,

If you want a client-side click event then use onclick in the declaration and run some javascript:

<asp:textbox runat="server" id="txtClickabl e" onclick="alert( 'clicked!');" text="[click into me for an alert]" />

If you want a server-side click event you could derive a class from TextBox and implement IPostBackEventH andler. Use the
ClientScriptMan ager (Page.ClientScr ipt) to render a post-back reference in the onclick attribute's javascript (.NET 2.0) or by using
a method of the Page class (.NET 1.*). In each case the method is called GetPostBackEven tReference, and it will write javascript
that causes the page to be posted back and the RaisePostBackEv ent method to be invoked on your class, where you can raise your
custom Click event. Be careful here, however, because your TextBox will not be useable on the client if you always render the
onclick javascript to post back. This is because each time the user clicks in your box, it will post back to the server and they
will never be able to actually enter text. And if you call txtClickable.Fo cus() in the 2.0 framework, it might be an endless
post-back loop!

--
Dave Sexton

"Dan Aldean" <do*******@roge rs.comwrote in message news:O0******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

I create a WEB application and I use a textbox, server control.
It does not have an OnClick event. Is it possible to create one?

Thanks

Oct 11 '06 #3
Dan,

You can set it in the property box autopostback to true
Cor

"Dan Aldean" <do*******@roge rs.comschreef in bericht
news:O0******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

I create a WEB application and I use a textbox, server control.
It does not have an OnClick event. Is it possible to create one?

Thanks

Oct 11 '06 #4
thanks for the answers.


"Dan Aldean" <do*******@roge rs.comwrote in message
news:O0******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

I create a WEB application and I use a textbox, server control.
It does not have an OnClick event. Is it possible to create one?

Thanks

Oct 11 '06 #5

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

Similar topics

1
2381
by: José Joye | last post by:
I know, this kind of question has already been asked. However, I could not find an answer related to the minimal privilege required to be able to create a new event Source in the appplication event log. I have a service app that needs to access shares (therefore, I cannot not start it using the System account). This service needs not to be run with particular privilege. So, I use a account member of users' group. Doing so will fail...
3
1798
by: leon | last post by:
hello friends, i am writing a page aspx and creating controls dinamicaly and then i must to create for each control the events as well. Anybody to know how????? happy day lion
0
1093
by: Andrea | last post by:
Hallo, i create controls dynamically on my webproject. most of the controls i create in the oninit-event and all worked wunderfull, but in the event-handling, e.g. the click-event of a button, i also want to create a control dynamically. the control will be created and showed, but some things don't work like i want it, e.g. the control is not correct positionied. if i do a postback, the control will be created in the oninit of the page...
1
329
by: Richard W | last post by:
I have a very simple web page (ASP.NET) that I am trying to build. On the web page is a checkbox that enables or disables other controls based upon the checked status. However, .NET fails to create the event handler for the CheckedChanged event. In addition, even if I manually create the event handler, the CheckedChanged event is never executed at runtime. AutoPostBack is set to True. Sometimes, ..NET "loses" blocks of code that I...
15
26518
by: Amit D.Shinde | last post by:
I am adding a new picturebox control at runtime on the form How can i create click event handler for this control Amit Shinde
7
1383
by: Rich | last post by:
Hello, I have 10 textboxes on a form. I would like to validate text-data entry on each textbox. I was looking for a Form_Current event or Form_Change event but did not recognize any such events. Or maybe there is a property for the Textboxes where I can set data entry conditions? Wondering about CausesValidation textbox property-how to use.
17
3311
by: Chris Podmore | last post by:
When I perform: EventLog.WriteEntry(strSource, strEntry, EventLogEntryType.Error, intEventID) The event viewer reports The description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. I think I need to create a dll that returns error messages for event ID’s.
3
3993
by: JohnR | last post by:
I have a form with a number of text boxes, comboboxes etc. What I would like to do is create an event handler for the "mouseenter" event for each of the controls whereby I display information about the control they just entered (sort of like an extended tooltip). Now, I can certainly create a separate mouseenter event for each control (too much work, and not very clever), but what I would like to do is somehow create one event that would...
2
2847
by: Boki | last post by:
Hi All, We can process the mouse/keyboard events by handling, however, how to create a event on a target form ( ex: webbrowser ) ? Thanks! Best regards, Boki.
0
3502
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by...
0
9540
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10475
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10250
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7564
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
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 we have to send another system
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.