473,480 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DropDownList inside a Repeater

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[i].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?

Jun 8 '06 #1
1 2688
Nevermind I had to use Request[] to get the data and rebuild the lists when
necassary.

"Jeremy" wrote:
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[i].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?

Jun 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2403
by: kamaumalone | last post by:
I have a dropdownlist which lives inside of a repeater. The repeater accepts user input via textboxes and the aforementioned dropdownlist. The repeater accepts phone numbers and allows for an...
7
6964
by: Darren | last post by:
Hi There, I am developing a shopping cart web application in C#. Product pricing for an item changes based on the weight of product purchased. ie: 100g=$4.95, 200g=$7.95, etc. Pricing is...
1
16851
by: Shaun Camilleri | last post by:
Hi all, I am creating a DropDownList in a RepeaterControl. After the Repeater is DataBound in the ItemCreated event (of the Repeater) I bind the DropDownList to a Table and then try to select one...
1
2141
by: Joe Gass | last post by:
I'd like to bind some xml to a dropdownlist <engines> <engine name="test1" id="1" /> <engine name="test2" id="2" /> </engines> If I do: ddlEngines.DataSource =...
3
3295
by: Ben Dewey | last post by:
Hey everyone, I have a wierd issue i can't seem to find out whats going on. I have a Control for a Shopping Cart Merchant Page called OrderStatus.ascx Inside that control there is a Repeater...
4
5092
by: jjack100 | last post by:
I have a DropDownList that is nested inside a Repeater. The datasource of the DropDownList is declared in the aspx, not the codebehind. So we have this: <asp:Repeater ID="rptOptions"...
1
520
by: Eugene Anthony | last post by:
ModifyUserRegistration.aspx --------------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ModifyUserRegistration.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC...
2
3726
by: MattB | last post by:
I have a (.Net 1.1) form with a Repeater and a DropDownList in the ItemTemplate. I programmatically make the DDL Autopostback = true at runtime based on the bound data. That works - I can see the...
2
9314
by: cookie0311 | last post by:
Hi I am trying to place three DropDownLists inside a Repeater, each DLL is dependent on it’s previous DDL’s selection. I’m developing in asp.net and VB. An Initial DDL (inside the repeater) needs...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5326
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2992
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.