473,474 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hooking into a getter or setter of .Net class

Hi,

Is there anyway that I can hook into a getter and setter of a property for a
..Net control across my application? Specifically, what I'd like to do is
execute some code whenever a System.Web.UI.WebControls.TextBox.Text property
is set'd or get'd. I'm aware there are things I can do such as wrap this
control, but for political reasons, I need to try to come up with a solution
that will involve changing or adding as little code as possible.

I am using .Net 3.5, so if there was this kind of functionality added that
would allow this, as it's similar to extension methods, I'd be able to use
that.

Thanks
Aug 8 '08 #1
2 3105
You need to use notification events really; you can't (without some
*major* hacking, i.e. pretending to be a debugger) just link into
arbitraty code. Fortunately, there is a TextChanged event you can
subscribe to.

If you want to apply this to all controls, you'd probably have to
override one of the init methods in ASP.NET to search (recursively)
for TextBox controls and subscribe to the event. I can't tell you
which init method to override as I'm not an ASP.NET expert, but try an
ASP.NET forum?

Marc
Aug 8 '08 #2
Marc Gravell wrote:
You need to use notification events really; you can't (without some
*major* hacking, i.e. pretending to be a debugger) just link into
arbitraty code. Fortunately, there is a TextChanged event you can
subscribe to.
Or use an aspect-oriented programming (AOP) weaving tool, which will
automatically modify the IL after compilation.
>
If you want to apply this to all controls, you'd probably have to
override one of the init methods in ASP.NET to search (recursively)
for TextBox controls and subscribe to the event. I can't tell you
which init method to override as I'm not an ASP.NET expert, but try an
ASP.NET forum?

Marc

Aug 8 '08 #3

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

Similar topics

3
by: Kiwi | last post by:
Hello. I know a getter can return other thing than a field. I know a setter can do more things than setting a field. I know there are "setter only" cases and "getter only" cases. I do use...
4
by: Jimbo | last post by:
I am sort of new to C#. Currently have a private property called "_name" in a class. I have written a public getter and setter routine for it called "Name". Currently, the getter for the...
1
by: Steve | last post by:
I generate C# webservices proxy code from WSDL file, it turns out the classes generated have public member variables and no getter/setter methods as follows, and I am able to get data when...
12
by: Adam Sandler | last post by:
Hi all, I hope this is an easy one... Using VWD 2005. When I call my accessor method (getName) I always receive an empty string back. Debugging shows there should be something there but I...
6
by: Peter Franks | last post by:
Is it possible to deserialize a class that has a public property w/ a setter, but no getter? I'm not finding anything that would allow this -- Presuming that is is NOT possible, what are the...
3
by: Martin Pöpping | last post by:
Hello, I´m coming from the Java World. Here Programmers often use (like in C++?) getter and setter methods. F.e.: class Mirror{ private int width_;
2
by: Amie | last post by:
Hi, I have an atlas related question.. I have a web form that submits the information to a web service method, and it's done thru Atlas by binding the web methods to client functions. It...
5
by: javatech007 | last post by:
Hi, I've been at this question all day and still just don't know what to do. It's the last of all the questions I have to do and can't figure it out!! If anyone could help or give guidance it...
1
by: mk | last post by:
It seems like getter is defined in such way that it passes only 'self': class FunDict(dict): def __init__(self): self.fundict = dict() def fget(self, fun): return fundict
0
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
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...
1
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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.