How to bind ViewData value to dropdownlist

2 posts, 0 answers
  1. mano
    mano avatar
    1 posts
    Member since:
    Aug 2015

    Posted 21 Aug 2015 Link to this post

    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 : "name_function_club",

                  dataValueField: "id_function_club",

                 ​BindTO: User

               });

    <script/>
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 24 Aug 2015 Link to this post

    Hello mano,

     

    In this forum discussion is explained how to access data from the ViewData from jQuery. I would suggest to use the data method of the DataSource in order to set the data retrieved from the ViewData. 

     

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top