DropDownList inside a Repeater

G

Guest

Hello All,

I have a Repeater which contains a Dynamic DropDownList within its
itemtemplate. I know I have struggled with this before and I am pretty sure I
had to save a bunch of crap manually to the viewstate, but does anyone know
what would cause those DropDownList objects to clear out on postback. Is
there a setting on the Repeater I am forgetting about? I tried tooling with
EnableViewState but that did not work. The Repeater gets filled only in the
!PostBack onLoad event, and the DropDownList objects are filled initially in
the ItemCreated event of that repeater.

Within the Repeater there is also CheckBox objects, which etain state fine
and PlaceHolder objects which Visibility gets reset onPostBack. It is driving
me nuts, I could have sworn there was something that would let me fill the
Repeater once, then access the values selected by iterating the RepeaterItem
objects. Here is the pseudocode because the regular code is way too long to
post:

onLoad {
if (!isPostBack) FillRepeater();
}

Repeater.onItemCreated {
FillDropDownBox()
}

Button.Click {
for (int i=0; i<Repeater.Items.Count; i++) {
selectedVal =
Repeater.Items.FindControl("DropDownBox").SelectedValue
}
}

That is pretty much what I was doing but when you postback because the
ItemCreated wasnt fired, the DropDownList is empty, furthermore, if I rebuild
the Repeater prior to trying to access its details we would lose all of the
changes the client made.

Any ideas anyone?
 
G

Guest

Nevermind I had to use Request[] to get the data and rebuild the lists when
necassary.
 

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,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top