This is a migrated thread and some comments may be shown as answers.

How to bind ViewData value to dropdownlist

1 Answer 620 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
mano
Top achievements
Rank 1
mano asked on 21 Aug 2015, 06:53 AM

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/>

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 24 Aug 2015, 03:39 PM

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!
 
Tags
DropDownList
Asked by
mano
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or