Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2007

Tip: Looking for answers? Try searching our database.

Detecting the active datagrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hans Fehlow - 19 Jul 2007 20:04 GMT
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
Peter Duniho - 19 Jul 2007 20:12 GMT
> 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?
Hans Fehlow - 19 Jul 2007 21:17 GMT
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

>> If I have 5 datagrids on a page but only a specific one, through coding,
>> is
[quoted text clipped - 3 lines]
> First you need to define "active".  Is it a matter of focus?  Enabled
> status?  Visibility?  Something else?
Peter Duniho - 19 Jul 2007 21:37 GMT
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.