Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have the Code As follows :
C#
qcAllocationDetails.BatchId = $("#batchIDSelect option:selected").map(function () {
       return $(this).val();
}).get().join(',');
   console.log(qcAllocationDetails.BatchId);


Ihave the controls as follows:
SQL
<select id="batchIDSelect" name="batchIDSelect" class="combo100" multiple="multiple">
                        </select>


I can select number of values from BatchId .My BatchId is Integer.Values are 1,2,3...and so on
its gives me error could not convert string to integer.Is there anyway to sort this problem.
In my above code ,where should i make the changes.Please guide me.I want to pass a string instead of integer .How is it possible.

Thanks
Harshal.
Posted
Updated 22-Apr-14 2:33am
v2
Comments
ravikhoda 22-Apr-14 8:38am    
i think the issue is with join. you try to join multiple selected options with , and that's why it is taking it as a string and can not convert to integer.
R Harshal 22-Apr-14 8:53am    
yes your are absolutely right .Please help me sir.

1 solution

What "convert"? It means parsing string to interpret it as integer. Please see:
http://www.iidproductions.com/JStutorials/Basics/parseInt.asp[^],
http://jsfiddle.net/ERpqM/2[^].

—SA
 
Share this answer
 
Comments
R Harshal 22-Apr-14 8:57am    
thanks for your reply but if you don't mind would you guide me in my code means the code which i wrote in that how i need to parse int. how to make the changes in my code.I really appreciate for your help.the link which you gave me is good enough but i am confused in my code how to change it .please guide me Sergey.
Thanks
Harshal.
Sergey Alexandrovich Kryukov 22-Apr-14 9:01am    
Didn't I answer your question? Please try to use the function I referenced and ask another question if you failed to do so. That's al the guidance you need. If you are confused with something, explain what are you confused with.
—SA

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