Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.22/5 (2 votes)
hii all

i am facing a problem with my project..

i want to selected multiple items from dropdown list and pass these multiple selected value in sql stored procedure in asp .net c#..

please give me idea to solve my problem..
yet i have no coding fro that.. i have no idea how to solve this problem

thanks to all..
Posted
Comments
jo.him1988 15-Jul-14 2:48am    
not sufficient for answer what you want,
if you want to pass all selected parameter in one time
take stringbulder and append selectd list item and pass it to sp
if you want to pass single item
than foreach loop to your selected list item and pass to sp
ArunRajendra 15-Jul-14 3:47am    
Post code what you have done
Pheonyx 15-Jul-14 4:06am    
What stored procedure? All you need to do is define your stored procedure to do what you want then pass the selected options back as parameters to the SQL command.

Concatenate all the values selected in the Dropdown using comma. Then pass this concatenated value to the parameter in the stored procedure. In the query assign this parameter as below


SQL
Select * from <table_name> Where <column_name> in (@parameter)</column_name></table_name>


Hope this helps
 
Share this answer
 
SQL
declare @var varchar(200)=' ''rs001'',''am001'' '

Exec ('select * from Emp_Master where empcode IN (' + @var + ')')


Try This one , Hope it will help you!
 
Share this answer
 
Here is a great article to do what you are asking.

Multi-select-Dropdown-list-in-ASP-NET
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900