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="txtClickable" 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 IPostBackEventHandler. Use the
ClientScriptManager (Page.ClientScript) 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 GetPostBackEventReference, and it will write javascript
that causes the page to be posted back and the RaisePostBackEvent 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.Focus() in the 2.0 framework, it might be an endless
post-back loop!