I assign user id and user name in viewdata,How to bind viewdata in dropdownlist using jquery.
<script>
var User=JSON.Parse('@html.Raw(Json.Encode(ViewData["UserDetails"]))');
$("#ddFunctionClub").kendoDropDownList({
height : 150,
dataTextField : "Username",
dataValueField: "UserId",
BindTO: User
});
<script/>
If you need to serialize your model to json use the following instead:
var user = @Html.Raw(Json.Encode(ViewData["UserDetails"]));
Your original statement below has a few things wrong with it, incorrect casing for classes, a string around the json and JSON.Parse errors:
var User=JSON.Parse('@html.Raw(Json.Encode(ViewData["UserDetails"]))');
Your dropdown would then use dataSource
to bind i.e.
$("#ddFunctionClub").kendoDropDownList({
dataSource : user,
dataTextField : "Username",
dataValueField: "UserId"
});