473,761 Members | 9,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Portal Error - A DropDownList cannot have multiple items selected.

Ok I am baffled I can not figure out this problem. I am getting the
following error:

Portal Error - A DropDownList cannot have multiple items selected.

Error information
Name Value
Message A DropDownList cannot have multiple items selected.
Source System.Web
TargetSite Void RenderContents( System.Web.UI.H tmlTextWriter)
StackTrace at
System.Web.UI.W ebControls.Drop DownList.Render Contents(HtmlTe xtWriter writer)
at System.Web.UI.W ebControls.WebC ontrol.Render(H tmlTextWriter writer) at
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) at
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) at
System.Web.UI.C ontrol.Render(H tmlTextWriter writer) at
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) at
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) at
System.Web.UI.H tmlControls.Htm lContainerContr ol.Render(HtmlT extWriter
writer) at System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) at
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) at
System.Web.UI.H tmlControls.Htm lForm.RenderChi ldren(HtmlTextW riter writer) at
System.Web.UI.H tmlControls.Htm lForm.Render(Ht mlTextWriter output) at
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) at
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) at
System.Web.UI.C ontrol.Render(H tmlTextWriter writer) at
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) at
System.Web.UI.P age.ProcessRequ estMain()
Also, I do you use the clearselection( ) method before loading any drop downs
so please do not offer that as a solution. Also, how come I don't get the
line number of the control that is having the problem? I am running IIS 5.0
and this using 1.1 framework.

Please help this won't go away ;).

--Tom

Nov 18 '05 #1
2 4772

I've had the same problem in different variations. Sometimes it's bee
due to databinding to a field with a NULL value. Other times ther
seems to be a problem with the RequiredFieldVa lidator and the dropdow
list control. I have one page in particular that gives this sam
exception after I use the Validate method on th
RequiredFieldVa lidator. Strangely enough, it seems to reset all of th
dropdown list controls on my page to have a selectedindex of 0, plus th
selectedindex that was previously set. I've been able to trap this b
adding an exception handler in the Render page override

--
JeffSchumache
-----------------------------------------------------------------------
JeffSchumacher' s Profile: http://www.msusenet.com/member.php?userid=50
View this thread: http://www.msusenet.com/t-15765

Nov 19 '05 #2

Turns out that what was causing my problem did have something to do wit
the RequiredFieldVa lidator control a ListItem object I used to add
"Please Select" option to each of four dropdowns. The code looke
something like this:

Dim tempItem As New System.Web.UI.W ebControls.List Item
tempItem.Text = "Please select..."
tempItem.Value = ""
tempItem.Select ed = False
Me.ddlTest1.Ite ms.Insert(0, tempItem)
Me.ddlTest2.Ite ms.Insert(0, tempItem)
Me.ddlTest3.Ite ms.Insert(0, tempItem)
Me.ddlTest4.Ite ms.Insert(0, tempItem)

To correct the problem, I used separate ListItem variables for eac
control:

Dim tempItem As New System.Web.UI.W ebControls.List Item
tempItem.Text = "Please select..."
tempItem.Value = ""
tempItem.Select ed = False
Me.ddlTest1.Ite ms.Insert(0, tempItem)

Dim tempItem2 As New System.Web.UI.W ebControls.List Item
tempItem2.Text = "Please select..."
tempItem2.Value = ""
tempItem2.Selec ted = False
Me.ddlTest2.Ite ms.Insert(0, tempItem2)

Dim tempItem3 As New System.Web.UI.W ebControls.List Item
tempItem3.Text = "Please select..."
tempItem3.Value = ""
tempItem3.Selec ted = False
Me.ddlTest3.Ite ms.Insert(0, tempItem3)

Dim tempItem4 As New System.Web.UI.W ebControls.List Item
tempItem4.Text = "Please select..."
tempItem4.Value = ""
tempItem4.Selec ted = False
Me.ddlTest4.Ite ms.Insert(0, tempItem4)

My guess is the the Validate function somehow uses a reference to th
original tempItem variable I had defined, and there were 4 control
referencing that variable. Go figure

--
JeffSchumache
-----------------------------------------------------------------------
JeffSchumacher' s Profile: http://www.msusenet.com/member.php?userid=50
View this thread: http://www.msusenet.com/t-15765

Nov 19 '05 #3

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

Similar topics

12
2805
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option Description"></asp:BoundColumn> <asp:TemplateColumn runat="server" HeaderText="Id Type Option" "> <itemtemplate> <asp:label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "TypeOption") %>' /> <asp:label runat="server" ID="LlbTypeOption" Visible=False...
1
3507
by: Aaron Prohaska | last post by:
I'm having the problem with this drop down list on postback. For some reason both the ListItems get selected when I change the selected item. Using the code below I'm building the drop down list in the overriden CreateChildControls method and setting the selected item. Then when I change the item in the drop down list the list is rebuilt from viewstate, but the initial item is still selected causing the error below. I also have a number...
5
1676
by: tshad | last post by:
Here is the DropDown: <asp:DropDownList ID="ScreenTest" runat="server" /> Here is the code: ScreenTest.DataSource=objCmd.ExecuteReader ScreenTest.DataValueField="ScreenTemplateMasterID" ScreenTest.DataTextField= "ScreenName" ScreenTest.databind() ScreenTest.Items.Insert(0, new ListItem("Select Screen Test",0))
1
2955
by: RichardH | last post by:
Hi, I have a ListItemCollection that I bind to DropDownList: ListItemCollection items = new ListItemCollection(); ListItem item; item = new ListItem("Option 1", "1"); items.Add(item); item = new ListItem("Option 2", "2"); item.Selected = true; items.Add(item);
11
5815
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
3
5282
by: Iain | last post by:
Hi All I have 2 DropDownList boxes on a page. The first (id= "Operation") is populated on PageLoad with the contents of a database table. The second id="WorkStations" will not be populated until the first has been changed The definitions are below.
4
6140
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the extra item just doesn't get added to the DropDownList: ============================================= <script runat="server"> Sub Page_Load(..........) Dim dSet As DataSet Dim sqlConn As SqlConnection
2
15253
by: =?Utf-8?B?S3Jpc2huYQ==?= | last post by:
Hi, I am devloping one web application using .net framework 2.0.One page has 7 dropdown list control.When i update the values first bind the values to the drop down llist then selected text using findbytext method.I got the following error ERROR: Cannot have multiple items selected in a DropDownList. Coding is below
2
3323
by: mylog | last post by:
Hi I am having a problem of getting the value from the dynamically generated table and dropdownlist. What I am facing is, I have created a table in the aspx page and now I need to add values to the the cells of the table respectively which I have done easily but the problem is when I add the dynamically generated dropdownlist to the cell I cannot read the value from the dropdownlist. For adding the dropdownlist in the cell I have done the...
0
9376
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
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
9923
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
9811
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...
0
8813
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
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
6640
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3509
muto222
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.