Groups > Asp .Net > Getting started with ASP.NET > Re: display text in dropdown list box.




display text in dropdown list box.

display text in dropdown list box.
Thu, 3 Apr 2008 23:09:44 +0000
I'm working in asp.net with c#. I have a dropdown list box with id as value and
name as text which is bounded to a stored procedure. Now i have to display a
particular value in that list box based on some search result. But it showing
the following error

"'drpDCList' has a SelectedValue which is invalid because it does not exist
in the list of items.
Parameter name: value"
Post Reply
Re: display text in dropdown list box.
Thu, 3 Apr 2008 23:28:04 +0000
Can you post the code you  are using to do your binding? I am betting the value
does not exist in the list. I would also reccomend using the Clear method on the
ddl items.

ddl.items.clear();

//Bind the data here
Post Reply
Re: display text in dropdown list box.
Thu, 3 Apr 2008 23:31:37 +0000
yes.. u r correct...

it was my mistake that i was trying to pass the items in the text instead of
values.

ie, name instead of id.

thanks a lot for ur input
Post Reply
about | contact