As I stated in my previous post, if you are binding to a control the Text Property of your cell will return and empty string.
I just ran a variation of your code and it seemed to work fine:
foreach (GridViewRow gvr in gv.Rows)
{
bool isChecked = ((CheckBox)gvr.FindControl("chkSec")).Checked;
if (isChecked)
{
Label lbl = (Label)gvr.FindControl("lblID");
str.Append(lbl.Text);
}
}
What triggers your code to be run? Are you making sure to rebind your grid on postbacks?
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========