Front Office Football Central  

Go Back   Front Office Football Central > Archives > FOFC Archive
Register FAQ Members List Calendar Mark Forums Read Statistics

Reply
 
Thread Tools
Old 01-09-2006, 10:28 AM   #1
PackerFanatic
Pro Starter
 
Join Date: Jul 2005
Location: Appleton, WI
C# Datagrid Help

Hey guys and gals, I am having some trouble finding help online with a quirky thing I am trying to do in C#, so maybe some programming guru out there can help me. I wish to retrieve the row number of a datagrid row based on the currently selected (or focused, more like) cell. What I basically want to do is based on whatever row is currently being edited, update further information in that row. I can further explain this for someone if they have a small idea as to lead me in the right direction. Thanks!

PackerFanatic is offline   Reply With Quote
Old 01-09-2006, 10:37 AM   #2
gstelmack
Pro Starter
 
Join Date: Oct 2000
Location: Cary, NC
.NET 1.0 or 2.0? Web or Forms?

There should be a "SelectedItem" or somesuch property of DataGrid. I'm trying to check online help now...

Ah, I see a "CurrentRowIndex" property.

Or there is "CurrentCell" which returns a "DataGridCell" which has "ColumnNumber" and "RowNumber" properties.


All of that is Windows Forms. Web controls don't have as rich an environment (at least in 1.0), so you're stuck with "SelectedIndex" and possibly iterating over child bits to get more details.

I don't have the 2.0 docs at work so I can't check that here.

The MSDN library is your friend (msdn.microsoft.com). All the bits above I got in about 2 minutes checking the on-line VS.NET 2003 documentation I have installed here, but the same stuff is available on-line if you're working outside of VS.NET.
__________________
-- Greg
-- Author of various FOF utilities
gstelmack is offline   Reply With Quote
Old 01-09-2006, 10:40 AM   #3
PackerFanatic
Pro Starter
 
Join Date: Jul 2005
Location: Appleton, WI
1.0 Forms.

Thanks for finding that, not sure why I never even though of the CurrentCell. I will have to check that out, thanks a lot!
__________________
Commissioner of the RNFL
PackerFanatic is offline   Reply With Quote
Old 01-10-2006, 08:45 AM   #4
PackerFanatic
Pro Starter
 
Join Date: Jul 2005
Location: Appleton, WI
Another question...I have been looking around and it seems that many people have this issue. I want to right-align the text in my column but left-align the header text. Is there a fairly simple way to do this or will it involve many overrides and all that?
__________________
Commissioner of the RNFL
PackerFanatic is offline   Reply With Quote
Old 01-10-2006, 09:08 AM   #5
gstelmack
Pro Starter
 
Join Date: Oct 2000
Location: Cary, NC
Quote:
Originally Posted by PackerFanatic
Another question...I have been looking around and it seems that many people have this issue. I want to right-align the text in my column but left-align the header text. Is there a fairly simple way to do this or will it involve many overrides and all that?
That I have no clue on.
__________________
-- Greg
-- Author of various FOF utilities
gstelmack is offline   Reply With Quote
Old 01-10-2006, 09:24 AM   #6
PackerFanatic
Pro Starter
 
Join Date: Jul 2005
Location: Appleton, WI
Damn, you failed me!

Haha, just kidding, the help you gave me yesterday really helped. This problem seems to be a little more tricky, sometimes .NET confuses me on their logic...
__________________
Commissioner of the RNFL
PackerFanatic is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump


All times are GMT -5. The time now is 05:29 PM.



Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.