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

[Solved] read value of other columns in a customized Combo Template

1 Answer 64 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 20 Nov 2014, 10:20 AM
Hi is it possible to read an entire rows data with a customized template on a combo box rather than just use dataValueField? I would like to return both the Key and Date values in the example below

@(Html.Kendo().DropDownListFor(m => m)
    .DataValueField("Key")
    .DataTextField("Key")
    .Events(e => e.Change("ReceiptPayments.invoices.change"))
    .HeaderTemplateId("Header")
    .TemplateId("Template")
)
    <div id="Header">
            <span class="col-sm-2">Number</span>
            <span class="col-sm-4">Date</span>
     </div>

    <div class="row" id="Template">
        <span class="col-sm-2">#: data.Key #</span>
        <span class="col-sm-4">#: data.Date #</span>
    </div>





1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 24 Nov 2014, 08:49 AM
Hello John,

I answered to the other ticket opened on the same subject. I would like to ask you continue our discussion there to avoid any duplication. Thank you for the understanding.

Here is a quote of the answer:

In general, the DropDownList is design to post its selected value defined by dataValueField option. It behaves just like every HTML input element. If you would like to send more information to the server, then you will need to get the selected data item. Use the dataItem method for this task:
var widget = $("#[widget id").data("kendoDropDownList");
 
var dataItem = widget.dataItem();
From here, you can send the data item using Ajax or posting with regular Html form element is required, then you will need to generate the required HTML input elements in order to post the additional data.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ComboBox
Asked by
John
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or