PC Review


Reply
Thread Tools Rate Thread

Cannot read ItemTemplate control values from Datagrid

 
 
Borked Pseudo Mailed
Guest
Posts: n/a
 
      7th Feb 2007

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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validator in Datagrid's ItemTemplate valeria007@gmail.com Microsoft ASP .NET 1 7th Nov 2005 10:54 PM
itemtemplate radiobuttonlist in a datagrid =?Utf-8?B?a2tyZXM=?= Microsoft Dot NET Framework 0 24th Jan 2005 05:41 PM
DataGrid appending to my ItemTemplate IDs? Jim Bancroft Microsoft ASP .NET 0 28th Dec 2004 03:51 PM
datagrid itemtemplate help angus Microsoft ASP .NET 2 16th Jun 2004 01:25 PM
Please help. ..Print form control values including datagrid values babu Microsoft Dot NET 3 13th Aug 2003 03:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:25 PM.