473,387 Members | 2,436 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,387 software developers and data experts.

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.HtmlTextWriter)
StackTrace at
System.Web.UI.WebControls.DropDownList.RenderConte nts(HtmlTextWriter writer)
at System.Web.UI.WebControls.WebControl.Render(HtmlTe xtWriter writer) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) at
System.Web.UI.Control.Render(HtmlTextWriter writer) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) at
System.Web.UI.HtmlControls.HtmlContainerControl.Re nder(HtmlTextWriter
writer) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) at
System.Web.UI.HtmlControls.HtmlForm.RenderChildren (HtmlTextWriter writer) at
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTex tWriter output) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) at
System.Web.UI.Control.Render(HtmlTextWriter writer) at
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at
System.Web.UI.Page.ProcessRequestMain()
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 4758

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 RequiredFieldValidator and the dropdow
list control. I have one page in particular that gives this sam
exception after I use the Validate method on th
RequiredFieldValidator. 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 RequiredFieldValidator 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.WebControls.ListItem
tempItem.Text = "Please select..."
tempItem.Value = ""
tempItem.Selected = False
Me.ddlTest1.Items.Insert(0, tempItem)
Me.ddlTest2.Items.Insert(0, tempItem)
Me.ddlTest3.Items.Insert(0, tempItem)
Me.ddlTest4.Items.Insert(0, tempItem)

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

Dim tempItem As New System.Web.UI.WebControls.ListItem
tempItem.Text = "Please select..."
tempItem.Value = ""
tempItem.Selected = False
Me.ddlTest1.Items.Insert(0, tempItem)

Dim tempItem2 As New System.Web.UI.WebControls.ListItem
tempItem2.Text = "Please select..."
tempItem2.Value = ""
tempItem2.Selected = False
Me.ddlTest2.Items.Insert(0, tempItem2)

Dim tempItem3 As New System.Web.UI.WebControls.ListItem
tempItem3.Text = "Please select..."
tempItem3.Value = ""
tempItem3.Selected = False
Me.ddlTest3.Items.Insert(0, tempItem3)

Dim tempItem4 As New System.Web.UI.WebControls.ListItem
tempItem4.Text = "Please select..."
tempItem4.Value = ""
tempItem4.Selected = False
Me.ddlTest4.Items.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
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...
1
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...
5
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"...
1
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 =...
11
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
3
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...
4
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...
2
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.