01-09-2006, 11:28 AM | #1 | ||
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!
|
||
01-09-2006, 11:37 AM | #2 |
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 |
01-10-2006, 09:45 AM | #4 |
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 |
01-10-2006, 10:08 AM | #5 | |
Pro Starter
Join Date: Oct 2000
Location: Cary, NC
|
Quote:
__________________
-- Greg -- Author of various FOF utilities |
|
01-10-2006, 10:24 AM | #6 |
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 |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|