tags:

views:

22

answers:

0

I want to fill dropdown from the Javascript object returned from JSON.parse(). Tried but not successfull. Please help

<script type="text/javascript" charset="utf-8">
<br />
    //This is returned from Model. All I want to put that in dropdown.<br />
    //var cat = JSON.parse('[{"Selected":false,"Text":"Blue","Value":"1"},{"Selected":false,"Text":"Red","Value":"2"},{"Selected":false,"Text":"Grey","Value":"3"},{"Selected":false,"Text":"Black","Value":"4"},{"Selected":false,"Text":"Green","Value":"5"},{"Selected":false,"Text":"Olive","Value":"6"},{"Selected":false,"Text":"Orange","Value":"7"},{"Selected":false,"Text":"Pink","Value":"8"},{"Selected":false,"Text":"Violet","Value":"9"},{"Selected":false,"Text":"Yellow","Value":"10"}]');

<br /><br />
    var cat = JSON.parse('<%= Html.ToJson(Model.Colors) %>');
<br />
</script>