Click here to Skip to main content
15,907,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all,

How can i get the value of the selected row in a datagrid.
The code
C#
"txt_1.Text = dataGrid1.Rows[i].Cells[i].Value.ToString()"
doesnt work in mobile application.

Thnx in advance!
Posted
Updated 3-Jun-12 21:26pm
v2

C#
foreach (GridViewRow row in GridView2.Rows)
            {
                  Label lb1 = (Label)row.FindControl("Label4");
            }
 
Share this answer
 
v2
Comments
blizznet 24-Apr-13 23:00pm    
Windows CE uses a DataGrid, no DataGridView, and a property of DataGrid.Rows doesn't exist
txt_1.Text = dataGrid1[row_num][column_num].ToString();
 
Share this answer
 
v2
Comments
blizznet 24-Apr-13 23:06pm    
CE DataGrid usage
txt_1.Text = dataGrid1[row_num,column_num].ToString();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900