We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

I want to set selectedindex or selectedvalue of dropdown in gridview

Technology must be angular js and mvc

I want to set dropdown selected index or selected value while data bind.

2 Replies

RA Rakesh Advani September 17, 2015 05:15 AM UTC

doing  updation of previous thread

Technolgy must be angular js and mvc

I want to use dropdown in gridview and I want to set the dropdown selected index or selected value while data bind of grid.




SA Saravanan Arunachalam Syncfusion Team September 18, 2015 11:35 AM UTC

Hi Rakesh,
Thank you for contacting Syncfusion Support.
We analyzed your requirement and we achieved using “DataBound” event of Grid in which we set the value for the dropdown using “setSelectedValue” method of Dropdownlist.
Please refer to the following code example.

<div id="targetsGrid" ej-grid e-datasource="data"

                   e-databound = "databoundtest"

                   >

   </div>

angular.module('listCtrl', ['ejangular'])

          .controller('PhoneListCtrl', function ($scope, $compile) {

                            . . .

                                $scope.databoundtest = "templateCompile";

                            . . .

          });


function templateCompile(args){

                                . . .

                                                 this.getContentTable().find(".drpAccessGroup").ejDropDownList("setSelectedValue","2");

                                }


We created the sample in jsplayground and please refer to the following link.
http://jsplayground.syncfusion.com/kmaczmiw
And also find the following documentation link for further reference of setSelectedValue method of Dropdown list.
http://jsplayground.syncfusion.com/kmaczmiw

Regards,
Saravanan.A

Loader.
Live Chat Icon For mobile
Up arrow icon