Cannot read ItemTemplate control values from Datagrid

  • Thread starter Borked Pseudo Mailed
  • Start date
B

Borked Pseudo Mailed

Hi,

I have a Datagrid with template columns (TextBox and Radiolist in them).
The ViewState seems to work but I'm unable to access the values of the
controls in the Datagrid at Page_Load(). The code

foreach ( DataGridItem dgi in MyGrid.Items )
{
System.Diagnostics.Debug.WriteLine( string.Format( "Count: {0}",
dgi.Cells.Count) );
System.Diagnostics.Debug.WriteLine( string.Format( "Text: {0}",
dgi.Cells[0].Text) );
System.Diagnostics.Debug.WriteLine( string.Format( "Text: {0}",
dgi.Cells[1].Text) );
System.Diagnostics.Debug.WriteLine( string.Format( "Text: {0}",
dgi.Cells[2].Text) );
}

returns an empty string for all the text values, even though the Count
value returns a correct value (the number of columns).

Any idea how I can read the values from the controls?

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top