Wizard, goto page, need to set values of a control in a Repeater

Inside a Repeater control I have a DropDownList control. If the user goes
through the wizard in page order, then in the OnItemCreated method I can set
the values in the list and it works great.

However, if they do a prev and change a value on the prev page, then when
they go back to the page with the Repeater I need to change the values in the
DropDownList that exists in each row of the Repeater.

Advertisements

As for the Repeater control inside the Wizard Step, how did you perform
databinding on it? Based on my test, when we change the current active Step
in Wizard control, the certain selected Step will reinit the controls in
it, and seems we need to repeform the databinding. thus, the ItemCreated or
ItemDataBound event will fire.

In addition, for Repeater control after databound, we can use the its
"Items" collection to loop through all the items in it, and use FindControl
to locate any sub controls in each RepeaterItem. e.g:

Advertisements

If I go to page 0, enter all the info, then click next, it first calls
Wizard.OnNextButtonClick and then Repeater.OnItemCreated. This works great as
it is in OnNextButtonClick that I get the data used in OnItemCreated.

However, if I do not enter all info in page 0, then click the wizard
shortcut on the right to go to page 1, then the shortcut to go back to page
0, then enter the info, it calls Repeater.OnItemCreated first and
Wizard.OnNextButtonClick second. So it is using the old data.

Is there a way to either: 1) Always get Wizard.OnNextButtonClick called
first or 2) in Wizard.OnNextButtonClick access each row in the repeater and
for each row, access a control?

Actually, the event sequence difference between the two times is due to the
ASP.NET server control's initlize and postback difference. Anyway, after
your repeater control has been databound, the data is stored in viewstate,
and when we switching between difference wizards, the repeater won't be
databound again(just recreate control structure and restore data from
viewstate). And if you want query or access each row (or a certain nested
control in each row), you can just use the code I mentioned in last reply.
e.g:

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!