This is a migrated thread and some comments may be shown as answers.

ASP Panel loses its controls

0 Answers 119 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bobi
Top achievements
Rank 1
Bobi asked on 20 Mar 2015, 03:56 PM
Hi, Support

i have a dynamically added repeater to asp Panel control (see the code below)

DataRepeater.ID = String.Format("DR{0}", ItemID);
DataRepeater.DataSource = oToDoList;
DataRepeater.DataBind();
 
foreach (RepeaterItem RItem in DataRepeater.Items)
{ ... }
 
pnlNiches.Controls.Add(DataRepeater);

This is working good, repeater is added to asp Panel. But, when I try to retrieve repeater items, it appears that panel doesn't contain any control.

Repeater DataRepeater = (Repeater)pnlNiches.FindControl(String.Format("DR{0}", ItemID));
if (DataRepeater != null)
{
    foreach (RepeaterItem RItem in DataRepeater.Items)
    { ... }
}

I am sure that I don't clear panel controls in the code.
What can be the reason of this strange behavior? Thanks in advance!

















No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Bobi
Top achievements
Rank 1
Share this question
or