Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to send list to Javascript funtion but i am getting output as


System.Linq.Enumerable+WhereSelectListIterator`2[BusinessEntity.BussinessImg,System.Int64]

JavaScript
<script>
    function SetSmallImages(emlt) {
       
        console.log(emlt);
    }
</script>



C#
List<BussinessImg> listBussinessImg = objBusinessDetailsbyID.BussinessImg.ToList();
         ScriptManager.RegisterClientScriptBlock(Page, GetType(), "img", "SetSmallImages('" + listBussinessImg.Select(a=>a.Bussiness_Img) + "')", true);
Posted
Comments
Sibasisjena 12-Feb-14 4:38am    
Get all the strings and concat all the strings separated by comma send it ti Javascript and split there.
Member-515487 12-Feb-14 4:42am    
no other option??

1 solution

As Sibasis suggested, you can try that method.
Refer - Pass List<int> from code behind to use in Javascript function[^].

Else you can use Json.NET[^] to serialize the Object and send.
Refer - pass list item from c# to javascript array[^]
 
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