473,386 Members | 1,969 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,386 software developers and data experts.

weird DropDownList problem..

Hi peeps

OK, I'm getting a weird error trying to select a DDL item based on what's
stored in the database.

I have 4 DDLs on my aspx page...

<asp:dropdownlist id="ddlStartTimeHour" runat="server" />
<asp:dropdownlist id="ddlEndTimeHour" runat="server" />
<asp:dropdownlist id="ddlStartTimeMinute" runat="server" />
<asp:dropdownlist id="ddlEndTimeMinute" runat="server" />

these are declared in the C# as

protected System.Web.UI.WebControls.DropDownList ddlStartTimeHour;
protected System.Web.UI.WebControls.DropDownList ddlStartTimeMinute;
protected System.Web.UI.WebControls.DropDownList ddlEndTimeHour;
protected System.Web.UI.WebControls.DropDownList ddlEndTimeMinute;

They are populated on Page_load with a couple of for loops (09, 10, 11 etc
for hour, 00,15,30,45 for minute). Then, Im trying to select the correct data
based on a DataReader as follows..

string[] timeStart, timeEnd;
timeStart = dr["SessionTimeStart"].ToString().Split(':');
timeEnd = dr["SessionTimeEnd"].ToString().Split(':');

ddlStartTimeHour.Items.FindByValue(timeStart[0]).Selected = true;
ddlStartTimeMinute.Items.FindByValue(timeStart[1]).Selected = true;
ddlEndTimeHour.Items.FindByValue(timeEnd[0]).Selected = true;
ddlEndTimeMinute.Items.FindByValue(timeEnd[1]).Selected = true;

The first two (the Start times) seem to work fine, but I get an error on the
EndTimeHour that says "A DropDownList cannot have multiple items selected". I
dont understand why this is happening, it happens even if I add
ddlEndTimeHour.SelectedItem = -1.

Even odder than that... the StartTime for the test date is 14:00, and the
end time is 15:30. Obviously theStartTIme works, but if I comment out the 2
EndTime.Select lines, the EndTime DDLs shows 14:00 as well!

It's as if ddlStartTimeHour and ddlEndTimeHour are connected, hence I get
the error about no multiples. But that *cant* be the case... can it?!

Any help appreciated!

Cheers
Dan
Nov 19 '05 #1
0 1147

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

Similar topics

0
by: shamila | last post by:
</asp:label><asp:datagrid id="DataGrid3" runat="server" cssclass="DataGrid" showfooter="True" onupdatecommand="DataGrid3_Update"ondeletecommand="DataGrid3_Delete" oneditcommand="DataGrid3_Edit"...
3
by: Wayne Dyer | last post by:
I can duplicate this, so I know it's not something I'm imagining and wonder if anyone else has seen it. Take a page, put a drop down control on it, hook up the onChange event handler to go get...
1
by: BW | last post by:
Hello, I am attempting to to take edited values from a datagrid control and update the underlying database. Problem is that some of the edited values don quite seem to make it to my update sub....
4
by: Mark Waser | last post by:
I've discovered a very odd bug when attempting to put a dropdown list in a datagrid. In the page PreRender step, the selected index of the datagrid is successfully set during databinding. Yet,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...

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.