R
ronnel.santiago
hi guys!
i came across an article of scott mitchell of 4guys entitled "Working with
Dynamically Created Controls, Part 2" and it was really a good read for me
as im doing a web project and doing it as much as possible ALL dynamic.
after reading the article i have some things that are not clear to me. from
his code snippet :
int count = 1;
void IterateThroughChildren(Control parent)
{
foreach (Control c in parent.Controls)
{
if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox")
&& c.ID. == null)
{
((TextBox) c).Text = "TextBox " + count.ToString();
((TextBox) c).Columns = 10;
count++;
}
if (c.Controls.Count > 0)
{
IterateThroughChildren(c);
}
}
}because im following his pattern, my question now is how can i "bind values
of dynamically loaded webcontrols to custom object". to further explain
things, this what i have, i have an Employee Class from which im doing this:
dim objEmployee as Employee
objEmployee.Firstname = ' the value of my dynamically created control
objEmployee.Lastname = ' the value of my dynamically created control
'
so in this approached how can i "BIND VALUES OF DYNAMICALLY LOADED
WEBCONTROLS TO CUSTOM OBJECT"?
TIA,
ronnel.santiago
i came across an article of scott mitchell of 4guys entitled "Working with
Dynamically Created Controls, Part 2" and it was really a good read for me
as im doing a web project and doing it as much as possible ALL dynamic.
after reading the article i have some things that are not clear to me. from
his code snippet :
int count = 1;
void IterateThroughChildren(Control parent)
{
foreach (Control c in parent.Controls)
{
if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox")
&& c.ID. == null)
{
((TextBox) c).Text = "TextBox " + count.ToString();
((TextBox) c).Columns = 10;
count++;
}
if (c.Controls.Count > 0)
{
IterateThroughChildren(c);
}
}
}because im following his pattern, my question now is how can i "bind values
of dynamically loaded webcontrols to custom object". to further explain
things, this what i have, i have an Employee Class from which im doing this:
dim objEmployee as Employee
objEmployee.Firstname = ' the value of my dynamically created control
objEmployee.Lastname = ' the value of my dynamically created control
'
so in this approached how can i "BIND VALUES OF DYNAMICALLY LOADED
WEBCONTROLS TO CUSTOM OBJECT"?
TIA,
ronnel.santiago