Thursday, September 28, 2023
HomeFun With ProgrammingHow to make selected default value in kendo dropdown dataSource?

How to make selected default value in kendo dropdown dataSource?

For making default value selected, You can do like this

$("#element-id").data("kendoDropDownList").value(your-value);

by using above, you can set directly value in kendo dropdown.

or if you want to select some option from the kendo dropdown by comparing some values then you can do it like this….

suppose, you initialize dropdown with datasource like this.

$("#element-id").kendoDropDownList({
          dataTextField: "companyname",
          dataValueField: "companyid",
          dataSource: dataComp,
          optionLabel: "--Select Company--"
});

so you can do like this

$("#element-id").data("kendoDropDownList").select(function (dataItem) {
      return dataItem.companyname === "Rahulya Info Tech";
});

You May Also Like:-

Priya Chauhan
Priya Chauhanhttps://rkrknowledge.com/
Hi πŸ‘‹, Myself Priya Chauhan from India. Content Editor | Coder | PHP Developer | UI Designer. I try to learn something new every day and share that knowledge with my friends.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Stay Connected

33FansLike
60FollowersFollow
520SubscribersSubscribe

Most Popular

Recent Comments