473,406 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

lost - dropdown list collection - small reward offered

I've bound a series of drop-down lists in a repeater control to a data
table. I've late bound them to datatable, and am using the
_ItemDataBound event to populate each control accordingly, and change the
name to reflect the ID field from the database.

This all works peachey, but the dynamic changing-of-name doesn't seem to
actually have done anything when I view the HTML source, so I'm apparently
loosing my unique ID for a start. Then when I try to read the form back, I
can't locate the controls using either the generic name they had originally,
or the new dynamic name.

Obviously I'm doing something dumb here, but I'm tearing my hair out trying
to finish this damn app. Can someone please point me in the right
direction?

Thanks in advance,

Dunc

..ASPX page
<asp:Repeater ID="VenueExtras" Runat="server">
<ItemTemplate>
<tr>
<td><strong><%# DataBinder.Eval(Container.DataItem, "ExtraName")
%></strong></td>
<td colspan="2">
<asp:DropDownList ID="VenueExtraItem" Runat="server">
<asp:ListItem Value="0">No</asp:ListItem>
<asp:ListItem Value="1">Yes</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>

..CS - data bind (note: "venue" refers to an instance of a strongly typed
dataset)
private void VenueExtras_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
DataRowView row = (DataRowView)e.Item.DataItem;
DropDownList objDDL =
(DropDownList)e.Item.FindControl("VenueExtraItem") ;
objDDL.ID = "VenueExtra_" + row[0].ToString();

// Check to see if this one is in the list
for (int iLoop = 0; iLoop < venue.VenueExtras.Rows.Count; iLoop++)
{
if (venue.VenueExtras[iLoop].VenueExtrasID ==
System.Convert.ToInt32(row[0]))
{
objDDL.SelectedIndex = 1;
}
}
}
}

..CS - get the values (or doesn't as the case may be)
private void SaveData()
{
for (int iLoop = 0; iLoop < dal.VenueExtrasGet().Rows.Count; iLoop++)
{
// This doesn't work
// DropDownList ddl =
(DropDownList)VenueExtras.FindControl("VenueExtra_ " +
dal.VenueExtrasGet().Rows[iLoop][0].ToString());
// Neither does this seem to
DropDownList ddl =
(DropDownList)VenueExtras.FindControl("VenueExtraI tem");

if (ddl != null)
{
Response.Write("Value: " + ddl.ID + "<BR>");
Response.Write("Value: " + ddl.SelectedValue + "<BR>");
}
}
}
Nov 16 '05 #1
0 2043

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

Similar topics

1
by: middletree | last post by:
For an ASp Intranet app, I have some code that should work, but I am not able to make it happen for some reason, after spending considerable time on this. I am pretty thick when it comes to...
32
by: Continental Translations | last post by:
Can anybody help me? I am trying to create two drop down menus, where the results of the second one vary depending on what was selected in the first one. I am using MS Script Editor in MS Front...
5
by: Nick Calladine | last post by:
Learning : Loop to list all dropdown box values on a form Can some one point me in the right direction : I have a form which I want to loop through I basically want to get all the selected...
3
by: Celine | last post by:
I have a webform with multiple panels with textboxes, dropdownlists, radiobuttonlists, etc. The user navigates through the panels and then submits the information at the end. The first panel...
1
by: Norm Katz | last post by:
When you use a bound combobox and you set its dropdown style to "dropdown" that allows you to enter text in the edit box. But if you enter anything other than a value in the current bound items...
14
by: Ron L | last post by:
All I am working with a DataGrid and a form consisting of a number of text, checkbox, combobox controls, all bound to the same datatable. When I click on my "New" button, I create a new row,...
4
by: Dabbler | last post by:
I have two tables I'm editing in a Gridview. The VANS table contains a key to the other LESSOR table. I would like to use a dropdown list to select the LessorId value while displaying the Lessor...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
5
by: plumba | last post by:
Hi all. I have two drop down menus, the first a list of Departments, the second a list of Sections. Each Department has a set of Setions, so the Sections dropdown contains complete list of all...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...

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.