473,756 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
+ 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.onItem Created {
FillDropDownBox ()
}

Button.Click {
for (int i=0; i<Repeater.Item s.Count; i++) {
selectedVal =
Repeater.Items[i].FindControl("D ropDownBox").Se lectedValue
}
}

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 2702
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.onItem Created {
FillDropDownBox ()
}

Button.Click {
for (int i=0; i<Repeater.Item s.Count; i++) {
selectedVal =
Repeater.Items[i].FindControl("D ropDownBox").Se lectedValue
}
}

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
2427
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 arbitrary number of empty rows to be added to it. So, if a user knew in advance that they wanted to add 3 phone numbers, they can type the nuber '3' in a textbox (outside the repeater) and click a button (also outside of a repeater), and 3 new empty ...
7
6993
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 different for each product. When viewing the cart, I would like the the user to have the ability to select a different weight, specific to that item, which would then modify the price of that cart item.
1
16908
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 of its value. Here is the code: If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItem.AlternatingItem Then Dim ddl as DropDownList = Ctype(e.Item.FindControl("ddl"), DropDownList) With ddl
1
2156
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 = xmlDoc.SelectNodes("/engines/engine")
3
3316
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 with the Products that were ordered on the ItemCreated event of the repeater i set a property of an options control within the repeater. The Options control sets a DropDownList and then sets a SelectedValue. The Selected Value prop is correct...
4
5108
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" runat="server"> <ItemTemplate> <%# Eval("option_name") %> <asp:DropDownList ID="dlOptions" runat="server" DataSource='<%#
1
520
by: Eugene Anthony | last post by:
ModifyUserRegistration.aspx --------------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ModifyUserRegistration.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
3748
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 postback happen appropriately. The DropDownList looks like this: <asp:DropDownList id="ddMultiQty" OnSelectedIndexChanged="ddMultiQty_SelectedIndexChanged" runat="server"></asp:DropDownList>
2
9341
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 to be populated under Page_load () through a stored proc, the selection from this needs to fire another stored proc and populate it’s child DDL. My main concern at this moment is how to populate the first DDL under page_load. I am able to do this...
0
10040
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9846
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.