Detecting the active datagrid

  • Thread starter Thread starter Hans Fehlow
  • Start date Start date
H

Hans Fehlow

Hi All;

This may be a very simple question, but for the life of me, don't know the
answer.

If I have 5 datagrids on a page but only a specific one, through coding, is
active at one time.
I want to know which is active, how do I determine that programmatically?

Hans Fehlow
ON, Canada
 
If I have 5 datagrids on a page but only a specific one, through coding,
is
active at one time.
I want to know which is active, how do I determine that programmatically?

First you need to define "active". Is it a matter of focus? Enabled
status? Visibility? Something else?
 
Good point and If I knew that I might not be asking that question.

Many Datagrids can be placed on an .aspx page with many different
attributes. All were defined as Visible.
But when you do a Datagrid1.DataBind() is when the datagrid1 is diaplayed,
but the logic could have told it to bind to DataGrid76.
Without using all the same selection logic again how do I determine which
data grid it was?
If the user clicks on a button to do something with that grid it no longer
has Focus, so what is it considered?

In reality I have many more than 5 defined to the page and the names are
more descriptive than DataGrid1....DataGrid76.

Probably not you normal way to do this, but works very fast.

Hans
 
Good point and If I knew that I might not be asking that question.

Many Datagrids can be placed on an .aspx page with many different
attributes. All were defined as Visible.

Well, for one: you did not mention that you were using ASP.NET in your
original post. A DataGrid is not unique to ASP, so it may be that that
piece of information is important to anyone reading your question.

I don't know anything about ASP, so I don't myself know whether it's
important or not. But you should be clear about your situation, in case
the ASP environment has some subtle difference from the basic Windows
Forms environment.
But when you do a Datagrid1.DataBind() is when the datagrid1 is
diaplayed, but the logic could have told it to bind to DataGrid76.

The logic could have told _what_ to bind to DataGrid76? You say "it", but
you haven't defined "it". The only other noun in your sentence is
"datagrid1", and I presume that you are not binding one datagrid to
another.
Without using all the same selection logic again how do I determine
which data grid it was?

What selection logic? You haven't mentioned any selection logic up to
this point.
If the user clicks on a button to do something with that grid it no
longer has Focus, so what is it considered?

I don't know. You still haven't determined that focus is what you mean by
"active". However, if "active" does mean "focus", then yes...you will
have to keep track of focus changes, remembering the most recent DataGrid
that had focus, so that when a button is pushed and gets focus, you can
still tell which DataGrid it's supposed to be applied to.
In reality I have many more than 5 defined to the page and the names are
more descriptive than DataGrid1....DataGrid76.

Let's keep this simple. Presumably the issue exists whether you have two
DataGrids or seventy-six of them. So, for the moment let's just assume
there's two.
Probably not you normal way to do this, but works very fast.

With the word "works" being used very loosely, at least for the moment. :)

Pete
 
Back
Top