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?
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?