bind values of dynamically loaded webcontrols to custom object

  • Thread starter ronnel.santiago
  • Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top