将Kendo ComboBox编辑器添加到NopCommerce

时间:2014-09-20 11:40:15

标签: kendo-ui nopcommerce kendo-combobox

如何在NopCommerce中为kendo ComboBox创建编辑器模板 我试过这个片段但是当打开页面时返回为html文本

//编辑

<input id="@ViewData.TemplateInfo.GetFullHtmlFieldId(string.Empty)" name="@ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty)"  />

<script>
    $(document).ready(function () {
        debugger;

    $("#@ViewData.TemplateInfo.GetFullHtmlFieldId(string.Empty)").kendoComboBox({
                        placeholder: "Select",
                        dataTextField: '@ViewData.ModelMetadata.AdditionalValues["dataTextField"]',
                        dataValueField: "@ViewData.ModelMetadata.AdditionalValues["dataValueField"]",
                        filter: "contains",
                        autoBind: false,
                        minLength: 3,
                        dataSource: {
                            type: "odata",
                            serverFiltering: true,
                            transport: {
                                read: {
                                    url: '@Html.Action(ViewData.ModelMetadata.AdditionalValues["ActionName"].ToString(), ViewData.ModelMetadata.AdditionalValues["Controller"].ToString())',
                                }
                            }
                        }
                    });
                });
</script> 

//在视图中

@Html.EditorFor(x => x.MyProperty)

//查看模型

[UIHint("ComboBox")]
[AdditionalMetadata("dataTextField","FirstName")]
[AdditionalMetadata("dataValueField","Id")]
[AdditionalMetadata("ActionName","MyActionName")]
[AdditionalMetadata("Controller","MyController")]
public int MyProperty{ get; set; }

请有人帮我解决这个案子

0 个答案:

没有答案