Hi i am initially using this code but now when i am debuging this code i am getting error ..
"The Controls collection cannot be modified because the control contains code blocks "
my code is:
for (int m = 0; m < dtGroupedByDate.Rows.Count; m++)
{
Label Date = new Label();
Date.Text = dtGrpBySmDate.Rows[m][0].ToString();
Date.Style["margin-left"] = (m > 0) ? "20px" : "0px";
this.Controls.Add(Date);
Label PowerSum = new Label();
PowerSum.Text = dtGroupedByDate.Rows[m][1].ToString();
PowerSum.Style["margin-left"] = "20px";
this.Controls.Add(PowerSum);
}
Please help me why i am getting this error..