| | |
Dropdownlist
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2009
Posts: 27
Reputation:
Solved Threads: 0
Hi,
I want to display a text, getting from database, into a DropdownList using text property.
My Code::
But It Display an error::
'drpcompname' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
Please help me.
Thanks!
Pankaj Singh
I want to display a text, getting from database, into a DropdownList using text property.
My Code::
ASP.NET Syntax (Toggle Plain Text)
SqlDataReader drd; if (drd.Read()) { drpcompname.Text = drd.GetValue(0).ToString(); }
But It Display an error::
'drpcompname' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
Please help me.
Thanks!
Pankaj Singh
Last edited by Ezzaral; Jul 3rd, 2009 at 1:00 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
Welcome Pankaj18,
Your source code must be surrounded with bb code tags. Read this How to use bb code tags?
Error message shows that a value you are assigned to the DropDownList control is not present inside the DropDownList's items.
Yes, the DropDownControl is empty. Isn't it?
Here, I am using bb code tags - See, how a source looks !!!
Your source code must be surrounded with bb code tags. Read this How to use bb code tags?
Error message shows that a value you are assigned to the DropDownList control is not present inside the DropDownList's items.
Yes, the DropDownControl is empty. Isn't it?
Here, I am using bb code tags - See, how a source looks !!!
ASP.NET Syntax (Toggle Plain Text)
SqlDataReader drd; ..... if (drd.Read()) { drpcompname..Items.Add(drd.GetValue(0).ToString()); }
Failure is not fatal, but failure to change might be. - John Wooden
•
•
Join Date: Jul 2009
Posts: 27
Reputation:
Solved Threads: 0
•
•
•
•
Welcome Pankaj18,
Your source code must be surrounded with bb code tags. Read this How to use bb code tags?
Error message shows that a value you are assigned to the DropDownList control is not present inside the DropDownList's items.
Yes, the DropDownControl is empty. Isn't it?
Here, I am using bb code tags - See, how a source looks !!!
ASP.NET Syntax (Toggle Plain Text)
SqlDataReader drd; ..... if (drd.Read()) { drpcompname..Items.Add(drd.GetValue(0).ToString()); }
Does your dropdownlist contains items? If yes then use
ASP.NET Syntax (Toggle Plain Text)
drpcompname.SelectedValue=drd.GetValue(0).ToString();
Failure is not fatal, but failure to change might be. - John Wooden
•
•
Join Date: Jul 2009
Posts: 27
Reputation:
Solved Threads: 0
•
•
•
•
Does your dropdownlist contains items? If yes then use
ASP.NET Syntax (Toggle Plain Text)
drpcompname.SelectedValue=drd.GetValue(0).ToString();
drpclienttype' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
help me..
Pankaj Singh
•
•
Join Date: Jul 2009
Posts: 27
Reputation:
Solved Threads: 0
Thanks.
But it working when dropdownlist have some values, i have another case when i have no items in dropdownlist,it have only one item 'Select One', it display same error::
'drpcompname' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
Thanks!
Pankaj Singh
But it working when dropdownlist have some values, i have another case when i have no items in dropdownlist,it have only one item 'Select One', it display same error::
'drpcompname' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
Thanks!
Pankaj Singh
![]() |
Similar Threads
- dropdownlist value doesnt get selected (ASP)
- GetSelectedIndex Datagrid? Dropdownlist (ASP.NET)
- disable dropdownlist with javascript (JavaScript / DHTML / AJAX)
- Help with dropdownlist data adding? (VB.NET)
- DataGrid: Edit mode, the index of a dropdownlist does not start at the right Value (ASP.NET)
- GetSelectedIndex Datagrid? Dropdownlist (C#)
- How do I save an index to a particular index of a dropdownlist in a datagrid. (C#)
- Help With Datagrid RE: Creating and Saving DropDownList ReportsToID (C#)
Other Threads in the ASP.NET Forum
- Previous Thread: a little help with Paypal...
- Next Thread: gridview
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox click commonfunctions compatible confirmationcodegeneration content contenttype courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dropdownmenu edit expose feedback flash flv form formatdecimal forms formview gridview homeedition iframe iis javascript jquery list listbox login menu microsoft mono mouse mssql multistepregistration nameisnotdeclared news numerical objects order panelmasterpagebuttoncontrols radio ratings reportemail rotatepage save schoolproject search security serializesmo.table silverlight smartcard software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webprogramming webservice xml youareanotmemberofthedebuggerusers






