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

Display text instead of Id

3 Answers 733 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
kalyan
Top achievements
Rank 1
kalyan asked on 26 Dec 2020, 05:55 AM

I have implemented cascading drop down functionality using the following URL

https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/grid-editing-cascading-dropdownlist

Is there a way to display Text of the drop down in the grid cell instead of Id

earlier help is highly appreciated

 

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 28 Dec 2020, 12:38 PM

Hello Kalyan,

That is possible as well. Bind the column to a nested property and display via a ClientTemplate the Text but bind the DropDownList to the Value.

public Customer Name { get; set; }
...
public class Customer 
    {
        public id Value { get; set; }
        public string Text { get; set; }

    }

columns.Bound(c => c.Name).Title("Name").ClientTemplate("#=Name.Text#");
.. 
@(Html.Kendo().DropDownListFor(m=>m)
      .DataValueField("Value")
      .DataTextField("Text")
      .BindTo(foodsFiltersSelectList)
)

Let me know if you have any questions

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
kalyan
Top achievements
Rank 1
answered on 28 Dec 2020, 05:02 PM
it worked but the value is not being refreshed after in line edit...can you help me on this
0
Nikolay
Telerik team
answered on 30 Dec 2020, 09:07 AM

Hi Kalyan,

I have prepared a small MVC project demonstrating Cascading DropDownLists editors for two Grid columns. Please find it attached.

The same principles for cascading are followed with the cascading dropdown having a function that takes the value of the parent DropDownList:

Each editor has a name and id that are the same as the property name of the model when using the EditorForModel syntax.

Take a look and let me know in case you have any questions or concerns that remained unanswered.

 Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
kalyan
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
kalyan
Top achievements
Rank 1
Share this question
or