|
-
Jan 31st, 2012, 05:27 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] "Get" dynamcially created user controls in code-behind.
I dynamically build up a table of dates/hours worked by a user.
Last row, for each date (column) contains a little user control where the user can enter some text.
The user control work with some jQuery/UI and I will end up with each control have a date and reason set in hidden controls.
How do I get hold of these controls only when the user click a button in the code-behind? (silly question I know, but I'm not used to how webforms does its' thing)
-
Jan 31st, 2012, 08:40 AM
#2
Thread Starter
Hyperactive Member
Re: "Get" dynamcially created user controls in code-behind.
I solved this one with the following recursive function:
Wasted my time with GetType and typeOf.
Code:
protected IList<DisputeEntry> GetControls(Control control)
{
foreach (Control ctrl in control.Controls)
{
if (ctrl is DisputeEntry)
{
var dispute = (DisputeEntry)ctrl;
disputes.Add(dispute);
}
GetControls(ctrl);
}
return disputes;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|