S
s.bussing
Hi, I have been reading for hours now, but I'm still not able to solve
my problem, though a lot of people are struggling with something
similar.
On my page I have a nested repeater. In the inner repeater for each
item a usercontrol is added which has a textbox and two buttons.
No I know that when the page is posted back (in my case by pushing one
of the buttons of the control), I have to recreate all the dynamic
control. I want to maintain the state of the controls, but thats the
second part. The first part is recreating the dynamic added controls.
Therefor I have a function which I call in the Page_Load. First I
check if the page is postedback if so, I call this function:
Private Sub ReloadDynamicControls()
Dim _Ctrl As Control = CustomControl()
Dim _Repeater As Repeater = Me.FindControl("rptFactor")
For Each OuterItem As RepeaterItem In _Repeater.Items
For Each InnerItem As RepeaterItem In
CType(OuterItem.FindControl("rptFactorItem"), Repeater).Items
InnerItem.FindControl("pnlToelichtingGedrag").Controls.Add(_Ctrl)
Next
Next
End Sub
But when the page is displayed it only shows the usercontrol for the
last items of the repeater. But it should show for every item. When
I'm debugging I can see that the items are there and the usercontrol
is added to the placeholder, at least that is what I guess. But it
never shows on the page anymore.
Any helps is highly appreciated.
Thx
my problem, though a lot of people are struggling with something
similar.
On my page I have a nested repeater. In the inner repeater for each
item a usercontrol is added which has a textbox and two buttons.
No I know that when the page is posted back (in my case by pushing one
of the buttons of the control), I have to recreate all the dynamic
control. I want to maintain the state of the controls, but thats the
second part. The first part is recreating the dynamic added controls.
Therefor I have a function which I call in the Page_Load. First I
check if the page is postedback if so, I call this function:
Private Sub ReloadDynamicControls()
Dim _Ctrl As Control = CustomControl()
Dim _Repeater As Repeater = Me.FindControl("rptFactor")
For Each OuterItem As RepeaterItem In _Repeater.Items
For Each InnerItem As RepeaterItem In
CType(OuterItem.FindControl("rptFactorItem"), Repeater).Items
InnerItem.FindControl("pnlToelichtingGedrag").Controls.Add(_Ctrl)
Next
Next
End Sub
But when the page is displayed it only shows the usercontrol for the
last items of the repeater. But it should show for every item. When
I'm debugging I can see that the items are there and the usercontrol
is added to the placeholder, at least that is what I guess. But it
never shows on the page anymore.
Any helps is highly appreciated.
Thx