Question

I'm looking for a method or an event that would get fired when a row in a datatable is accessed.

I have a datatable with several thousand rows, and an image in at least one of the columns. I want to dynamically load and unload the image from the row when it gets accessed.

I haven't seen any documentation that suggests that it's there, but I thought I'd post and see if anyone knows.

Was it helpful?

Solution

The problem is that you have to define "accessed". If you're talking about "displayed" then you probably don't really want to tie into the DataTable but rather the grid (or list or whatever is displaying the DataTable). If you mean "touched" then you have a trickier problem. There's no event on the DataTable or DataRow objects for you to tie into, but the items in a DataRow are all objects. Which means you could probably do something on the "cell" level, particularly if you're using WPF and can substitute in a System.Windows.Controls.Image object.

I'd be careful, though. This sounds like it could be a case of premature optimization.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top