Some ideas:
A) use FindControl on the object you added your control to:
Control empPeriod = this.LoadControl("EmploymentPeriod.ascx");
empPeriod.id="empPeriodId";
emp1.Controls.Add(empPeriod);
.Control empPeriod1 = empPeriod.FindControl("empPeriodId");
B) create an arraylist of the controls you've added, then use that later:
ArrayList list = new ArrayList();
for (i = 0; i < 10; i++)
{
Control empPeriod = this.LoadControl("EmploymentPeriod.ascx");
list.Add(empPeriod);
emp1.Controls.Add(empPeriod);
}
...
for (i = 0; i < 10; i++)
{
Control empPeriod1 = (Control)list[i];
......
}
C) do a recursive search for your controls
public void iterate(Control c)
{
if (c is YourType)
{
do_something(c);
}
forech (Control c1 in c.Controls)
{
iterate(c1);
}
}
Friday, March 19, 2004
Some ideas how to iterate throw Controls
at 9:00 PM Posted by roni schuetz
Subscribe to:
Post Comments (Atom)
Shared Cache - .Net Caching made easy
All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.
No comments:
Post a Comment