0

I would like to retrieve the value of whats stored in a currenlty selected row in my datagrid and store it in a string.

1. Is this possible?
2. If so how might I go about doing it

myDataGrid.Rows.Cell[0].etc.etc doesn't seem to work and it is all I could find on the internet

2
Contributors
9
Replies
11
Views
7 Years
Discussion Span
Last Post by EricDLundquist
0

I tried string

myString = myDataGrid.Rows[0].Cells[0].etc

and I get DataGrid has no method for Rows or something to that extent

Edited by EricDLundquist: n/a

0

Can I know which asp.net version are you using? Please post complete source code here.

string DataGridValue;
MainDataGrid.SelectedIndex = 0;
DataGridValue = ThisDataGrid.Rows[0].Cell[0].ToString();

ASP.NET Version# 3.0.50106.0

0
DataGridValue = ThisDataGrid.Rows[0].Cell[0].Text;

I get datagrid does not contain a definition for Rows

0

I think you should have to post source code.

See this code,

foreach (YourDataType item in ThisDataGrid.SelectedItems)
    {
          ....
    }
0

I think you should have to post source code.

See this code,

foreach (YourDataType item in ThisDataGrid.SelectedItems)
    {
          ....
    }

I would post the source code, but there is only so much I can post at work. Im a Mac guy most of the time so work is the only time I get access to c#

0
foreach (Object thisRow in MyDataGrid.SelectedItems)
                {
                    
                    StringTestTextBox.Text = thisRow.ToString();

                }
            }

returns the path to the class that stores the data

i.e MyProjectSolution.MyClass

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.