1
votes

I'd appreciate if someone could advise on the following:

My Multiselect:

 @Html.Kendo().MultiSelectFor(model => model.PAYMENT_METHOD).BindTo(paymentMethods).DataTextField("TITLE").DataValueField("CODE")

The dataSource looks like this:

CODE     TITLE
  1       abc
  2       def

Is it possible to have composite DataTextField , specifically like: 1 - abc, 2 - def, etc., i.e "CODE" - "TITLE"?

I know I could create a select list and define the format of textfield, but maybe there is another way? Thanks!

1

1 Answers

3
votes

You could specify a template for the display item (you would probably want to take the text field out then):

 @Html.Kendo().MultiSelectFor(model => model.PAYMENT_METHOD)
              .BindTo(paymentMethods)
              //.DataTextField("TITLE")
              .DataValueField("CODE")
              .ItemTemplate("#= CODE# #=' - '# #= TITLE#")

Here's the link to the ItemTemplate method and the link to the general template methods.