Пример #1
0
        public static MultiSelectBuilder MultiSelectListControl(this HtmlHelper helper, MultiSelectInformation multi)
        {
            Action<ReadOnlyDataSourceBuilder> dataSource = new Action<ReadOnlyDataSourceBuilder>(d =>
            {
                if (!string.IsNullOrWhiteSpace(multi.Url))
                {
                    d.Read(read => read.Url(multi.Url).Type(HttpVerbs.Post));
                }
                else if (!string.IsNullOrWhiteSpace(multi.DataActionName))
                {
                    d.Read(multi.DataActionName, multi.ControllerName);
                }
            });
            Action<MultiSelectEventBuilder> multie = new Action<MultiSelectEventBuilder>(e =>
            {
                if (!string.IsNullOrWhiteSpace(multi.Change))
                {
                    e.Change(multi.Change);
                }
                if (!string.IsNullOrWhiteSpace(multi.Close))
                {
                    e.Close(multi.Close);
                }
                if (!string.IsNullOrWhiteSpace(multi.Open))
                {
                    e.Open(multi.Open);
                }
                if (!string.IsNullOrWhiteSpace(multi.Select))
                {
                    e.Select(multi.Select);
                }

            });


            return helper.Kendo().MultiSelect()
                .Name(multi.Name)
                .Filter(FilterType.Contains)
                //.Enable(multi.Enable)
                //.BindTo(multi.BindTo)
                .HeaderTemplate(multi.HeaderTemplate)
                .Placeholder(multi.Placeholder)
                //.Value(multi.Value)
                .DataTextField(multi.DataTextField)
                .DataValueField(multi.DataValueField)
                .DataSource(dataSource).ValuePrimitive(true)
                .Height(multi.Height)
                .Events(multie)
                .Enable(true)
                .MaxSelectedItems(multi.MaxSelectedItems)
                .HtmlAttributes(new { style = "width:" + multi.Width + "px;" })
                .Value(new string[] { multi.ValueMultiselect });
        }
Пример #2
0
        public static MultiSelectBuilder MultiSelectListControl(this HtmlHelper helper, MultiSelectInformation multi)
        {
            Action <ReadOnlyDataSourceBuilder> dataSource = new Action <ReadOnlyDataSourceBuilder>(d =>
            {
                if (!string.IsNullOrWhiteSpace(multi.Url))
                {
                    d.Read(read => read.Url(multi.Url).Type(HttpVerbs.Post));
                }
                else if (!string.IsNullOrWhiteSpace(multi.DataActionName))
                {
                    d.Read(multi.DataActionName, multi.ControllerName);
                }
            });
            Action <MultiSelectEventBuilder> multie = new Action <MultiSelectEventBuilder>(e =>
            {
                if (!string.IsNullOrWhiteSpace(multi.Change))
                {
                    e.Change(multi.Change);
                }
                if (!string.IsNullOrWhiteSpace(multi.Close))
                {
                    e.Close(multi.Close);
                }
                if (!string.IsNullOrWhiteSpace(multi.Open))
                {
                    e.Open(multi.Open);
                }
                if (!string.IsNullOrWhiteSpace(multi.Select))
                {
                    e.Select(multi.Select);
                }
            });


            return(helper.Kendo().MultiSelect()
                   .Name(multi.Name)
                   .Filter(FilterType.Contains)
                   //.Enable(multi.Enable)
                   //.BindTo(multi.BindTo)
                   .HeaderTemplate(multi.HeaderTemplate)
                   .Placeholder(multi.Placeholder)
                   //.Value(multi.Value)
                   .DataTextField(multi.DataTextField)
                   .DataValueField(multi.DataValueField)
                   .DataSource(dataSource).ValuePrimitive(true)
                   .Height(multi.Height)
                   .Events(multie)
                   .Enable(true)
                   .MaxSelectedItems(multi.MaxSelectedItems)
                   .HtmlAttributes(new { style = "width:" + multi.Width + "px;" })
                   .Value(new string[] { multi.ValueMultiselect }));
        }