public override string HtmlString(HtmlHelper helper, string nameFormat)
 {
     return @"<span class=""td-filter-input k-header"">с " +
         helper.Kendo().DatePicker()
             .Name(string.Format(nameFormat, Name + "Begin"))
             //.HtmlAttributes(new { @class = "td-filter-input" })
             .ToHtmlString()
         + " по " +
         helper.Kendo().DatePicker()
             .Name(string.Format(nameFormat, Name + "End"))
             //.HtmlAttributes(new { @class = "td-filter-input" })
             .ToHtmlString()
        + "</span>";
 }
Example #2
0
 public override string HtmlString(HtmlHelper helper, string nameFormat)
 {
     return(@"<span class=""td-filter-input k-header"">с " +
            helper.Kendo().DatePicker()
            .Name(string.Format(nameFormat, Name + "Begin"))
            //.HtmlAttributes(new { @class = "td-filter-input" })
            .ToHtmlString()
            + " по " +
            helper.Kendo().DatePicker()
            .Name(string.Format(nameFormat, Name + "End"))
            //.HtmlAttributes(new { @class = "td-filter-input" })
            .ToHtmlString()
            + "</span>");
 }
        KendoMultiSelect(this HtmlHelper helper, string name, string[] forval, string dataTextField, string dataValueField,
                         string controlerName, string actionName, string htmlStyle = "")
        {
            if (string.IsNullOrEmpty(htmlStyle))
            {
                htmlStyle = "width: 100%";
            }
            return(helper.Kendo().MultiSelect()
                   .Name(name)
                   .Value(forval)
                   .HtmlAttributes(new { style = htmlStyle })
                   .DataTextField(dataTextField)
                   .DataValueField(dataValueField)
                   .Filter(FilterType.Contains)

                   .Events(e => e.Change("OnKendoMultiSelectChange").Select("OnKendoMultiSelectSelect"))

                   .DataSource(source =>
            {
                source.Read(read =>
                {
                    read.Action(actionName, controlerName);
                });
            }));
        }
Example #4
0
        public static SplitterBuilder SplitterControl(this HtmlHelper helper, SplitterInformation splitter)
        {
            Action <SplitterPaneFactory> pane = new Action <SplitterPaneFactory>(p =>
            {
                foreach (var item in splitter.Panes)
                {
                    if (string.IsNullOrEmpty(item.Value.WidthPanes))
                    {
                        item.Value.WidthPanes = "100%";
                    }
                    if (!string.IsNullOrEmpty(item.Value.ControllerName) || !string.IsNullOrEmpty(item.Value.ActionName))
                    {
                        p.Add()
                        .LoadContentFrom(item.Value.ActionName, item.Value.ControllerName)
                        .Collapsible(item.Value.Collapsible)
                        .Scrollable(item.Value.Scrollable)
                        .Size(item.Value.WidthPanes);
                    }
                    else
                    {
                        p.Add()
                        .Content(item.Value.Content)
                        .Collapsible(item.Value.Collapsible)
                        .Scrollable(item.Value.Scrollable)
                        .Size(item.Value.WidthPanes);
                    }
                }
            });

            return(helper.Kendo().Splitter()
                   .Name(splitter.Name)
                   .HtmlAttributes(new { style = "height:" + splitter.Height + "px;" })
                   .Panes(pane));
        }
Example #5
0
 public override string HtmlString(HtmlHelper helper, string nameFormat)
 {
     return(helper.Kendo().TextBox()
            .Name(string.Format(nameFormat, Name))
            .HtmlAttributes(new { @class = "td-filter-input" })
            .ToHtmlString());
 }
Example #6
0
        public static DateTimePickerBuilder VnrDateTimePickerFor <TModel>(this HtmlHelper <TModel> helper, Expression <Func <TModel, DateTime?> > expression, DateTimePickerBuilderInfo builderInfo)
        {
            var dateTimePickerBuilder = helper.Kendo().DateTimePickerFor(expression)
                                        .Enable(builderInfo.Enable)
                                        .Start(builderInfo.Start)
                                        .Format(builderInfo.Format)
                                        .TimeFormat(builderInfo.TimeFormat)
                                        .Depth(builderInfo.Depth)
                                        .Min(builderInfo.Min)
                                        .Max(builderInfo.Max);

            //.Culture(builderInfo.Culture);
            if (!string.IsNullOrWhiteSpace(builderInfo.Format))
            {
                //dateTimePickerBuilder.Format(builderInfo.Format);
                //[Hien.Nguyen] 21/10/2014 - Đồng nhất lại định dạng là dd/MM/yyyy
                dateTimePickerBuilder.Format(ConstantFormat.HRM_Format_DayMonthYear_HoursMin);
            }
            if (!string.IsNullOrWhiteSpace(builderInfo.Name))
            {
                dateTimePickerBuilder.Name(builderInfo.Name);
            }

            if (!string.IsNullOrWhiteSpace(builderInfo.Value))
            {
                dateTimePickerBuilder.Value(builderInfo.Value);
            }

            if (!string.IsNullOrWhiteSpace(builderInfo.StyleCss))
            {
                dateTimePickerBuilder.HtmlAttributes(new { style = builderInfo.StyleCss, placeholder = builderInfo.Placeholder });
            }

            return(dateTimePickerBuilder);
        }
Example #7
0
        public static SplitterBuilder VnrSplitter(this HtmlHelper helper, SplitterBuilderInfo builderInfo)
        {
            var pane = new Action <SplitterPaneFactory>(p =>
            {
                foreach (var item in builderInfo.Panes)
                {
                    if (!string.IsNullOrWhiteSpace(item.Value.Content))
                    {
                        p.Add()
                        .Content(item.Value.Content)
                        .Collapsible(item.Value.Collapsible)
                        .Scrollable(item.Value.Scrollable)
                        .Size(item.Value.Size)
                        .Resizable(item.Value.Resizable);
                    }
                    else if (!string.IsNullOrEmpty(item.Value.Controller) || !string.IsNullOrEmpty(item.Value.ActionName))
                    {
                        p.Add()
                        .LoadContentFrom(item.Value.ActionName, item.Value.Controller)
                        .Collapsible(item.Value.Collapsible)
                        .Scrollable(item.Value.Scrollable)
                        .Size(item.Value.Size)
                        .Resizable(item.Value.Resizable);
                    }
                }
            });
            var splitterBuilder = helper.Kendo().Splitter()
                                  .Orientation(builderInfo.Orientation)
                                  .Name(builderInfo.Name)
                                  .HtmlAttributes(new { style = "height:" + builderInfo.Height + "px;" })
                                  .Panes(pane);

            return(splitterBuilder);
        }
Example #8
0
        public static GridBuilder <T> ReadAndDeleteGrid <T>(
            this HtmlHelper helper,
            string controllerName,
            Expression <Func <T, object> > modelIdExpression,
            Action <GridColumnFactory <T> > columns = null) where T : class
        {
            if (columns == null)
            {
                columns = cols =>
                {
                    cols.AutoGenerate(true);
                    cols.Command(c => c.Destroy());
                };
            }

            return(helper.Kendo()
                   .Grid <T>()
                   .Name("grid")
                   .Columns(columns)
                   .ColumnMenu()
                   .Pageable(page => page.Refresh(true))
                   .Sortable()
                   .Groupable()
                   .Filterable()
                   .Editable(edit => edit.Mode(GridEditMode.PopUp))
                   .Resizable(resize => resize.Columns(true))
                   .DataSource(data => data
                               .Ajax()
                               .Model(m => m.Id(modelIdExpression))
                               .ServerOperation(true)
                               .Events(ev => ev.Error("errorHandler"))
                               .Read(read => read.Action("Read", controllerName))
                               .Destroy(destroy => destroy.Action("Destroy", controllerName))));
        }
Example #9
0
        public static MvcHtmlString MultiSelect(this HtmlHelper htmlHelper, string name, dynamic value, string datacontroller = "", string dataaction = "")
        {
            var controller = "";
            var action     = "";

            #region Attributes
            if (!string.IsNullOrEmpty(datacontroller))
            {
                controller = datacontroller.ToString();
            }
            if (!string.IsNullOrEmpty(dataaction))
            {
                action = dataaction.ToString();
            }
            #endregion
            return(MvcHtmlString.Create(htmlHelper.Kendo().MultiSelect()
                                        .Name(name)
                                        .DataTextField("TEXT")
                                        .DataValueField("VALUE")
                                        .AutoBind(false)
                                        .DataSource(source =>
            {
                source.Read(read =>
                {
                    read.Action(action, controller);
                }).ServerFiltering(false);
            })
                                        .Value((List <MultiSelectResult>)value).ToString()
                                        ));
        }
Example #10
0
 public static MvcHtmlString TextEditor(this HtmlHelper htmlHelper, string name, object value, IDictionary <string, object> htmlAttributes = null)
 {
     return(MvcHtmlString.Create(htmlHelper.Kendo().Editor()
                                 .Name(name)
                                 .HtmlAttributes(new { style = "width: 563px;height:200px" })
                                 .Tools(tools => tools
                                        .InsertFile()
                                        .SubScript()
                                        .SuperScript()
                                        .ViewHtml()
                                        .FontName()
                                        .FontSize()
                                        .FontColor().BackColor()
                                        )
                                 .Value(value.ToString())
                                 .ImageBrowser(imageBrowser => imageBrowser
                                               .Image("~/MCContent/Uploads/Editor/{0}")
                                               .Read("Read", "Editor")
                                               .Create("Create", "Editor")
                                               .Destroy("Destroy", "Editor")
                                               .Upload("Upload", "Editor")
                                               .Thumbnail("Thumbnail", "Editor"))
                                 .FileBrowser(fileBrowser => fileBrowser
                                              .File("~/MCContent/Uploads/Editor/{0}")
                                              .Read("Read", "Editor")
                                              .Create("Create", "Editor")
                                              .Destroy("Destroy", "Editor")
                                              .Upload("Upload", "Editor")
                                              ).ToString()));
 }
Example #11
0
 public static Kendo.Mvc.UI.Fluent.MultiSelectBuilder MultiSelectCr(this HtmlHelper helper, string name, IEnumerable <SelectListItem> list, string optionLabel = _optionLabel)
 {
     return(helper.Kendo().MultiSelect()
            .Name(name)
            .BindTo(list)
            .Placeholder(optionLabel));
 }
Example #12
0
 public static Kendo.Mvc.UI.Fluent.DropDownListBuilder DropDownListCr(this HtmlHelper helper, string name, IEnumerable <SelectListItem> list, Dictionary <string, object> htmlAttributes, string optionLabel = _optionLabel)
 {
     return(helper.Kendo().DropDownList().Name(name)
            .BindTo(list)
            .HtmlAttributes(htmlAttributes)
            .OptionLabel(optionLabel));
 }
Example #13
0
 public static Kendo.Mvc.UI.Fluent.DropDownListBuilder DropDownListCr(this HtmlHelper helper, string name, string dependentDropDownName, IEnumerable list, string optionLabel = _optionLabel)
 {
     return(helper.Kendo().DropDownList().Name(name)
            .BindTo(list)
            .CascadeFrom(dependentDropDownName)
            .OptionLabel(optionLabel));
 }
Example #14
0
 public override string HtmlString(HtmlHelper helper, string nameFormat)
 {
     return helper.Kendo().TextBox()
             .Name(string.Format(nameFormat, Name))
             .HtmlAttributes(new { @class = "td-filter-input" })
             .ToHtmlString();
 }
Example #15
0
        /// <summary>
        /// Dùng nhập các giá trị là số và cho phép giá trị có thể null
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <typeparam name="TValue"></typeparam>
        /// <param name="helper"></param>
        /// <param name="expression"></param>
        /// <param name="builderInfo"></param>
        /// <returns></returns>
        public static NumericTextBoxBuilder <TValue> VnrNumericTextBoxFor <TModel, TValue>(this HtmlHelper <TModel> helper,
                                                                                           Expression <Func <TModel, TValue?> > expression, NumericTextBoxBuilderInfo <TValue> builderInfo) where TValue : struct
        {
            var numericTextBoxBuilder = helper.Kendo().NumericTextBoxFor(expression).Min(builderInfo.Min).Max(builderInfo.Max).Enable(builderInfo.Enable);

            if (!string.IsNullOrWhiteSpace(builderInfo.Format))
            {
                numericTextBoxBuilder.Format(builderInfo.Format);
            }
            if (!string.IsNullOrWhiteSpace(builderInfo.Placeholder))
            {
                numericTextBoxBuilder.Placeholder(builderInfo.Placeholder);
            }
            if (!string.IsNullOrWhiteSpace(builderInfo.StyleCss))
            {
                numericTextBoxBuilder.HtmlAttributes(new { style = builderInfo.StyleCss });
            }
            if (!string.IsNullOrWhiteSpace(builderInfo.Name))
            {
                numericTextBoxBuilder.Name(builderInfo.Name);
            }
            if (!string.IsNullOrWhiteSpace(builderInfo.EvenChange))
            {
                numericTextBoxBuilder.Events(m => m.Change(builderInfo.EvenChange));
            }

            if (typeof(TValue) == typeof(double))
            {
                double value = Convert.ToDouble(builderInfo.Value);
                if (value != 0)
                {
                    numericTextBoxBuilder.Value(builderInfo.Value);
                }

                double step = Convert.ToDouble(builderInfo.Step);
                if (step != 0)
                {
                    numericTextBoxBuilder.Step(builderInfo.Step);
                }
                if (builderInfo.Decimals > 0)
                {
                    numericTextBoxBuilder.Decimals(builderInfo.Decimals);
                }
            }
            if (typeof(TValue) == typeof(int))
            {
                int value = Convert.ToInt32(builderInfo.Value);
                if (value != 0)
                {
                    numericTextBoxBuilder.Value(builderInfo.Value);
                }

                int step = Convert.ToInt32(builderInfo.Step);
                if (step != 0)
                {
                    numericTextBoxBuilder.Step(builderInfo.Step);
                }
            }
            return(numericTextBoxBuilder);
        }
Example #16
0
 public static NumericTextBoxBuilder <T> VnrNumericTextbox <T>(this HtmlHelper helper, NumericTextboxInfomation numericInfo) where T : struct
 {
     return(helper.Kendo().NumericTextBox <T>()
            .Name(numericInfo.Name)
            .Format(numericInfo.Format)
            .Placeholder(numericInfo.Placeholder));
 }
Example #17
0
        public static GridBuilder <T> GridControl <T>(this HtmlHelper helper, string name) where T : class
        {
            //return helper.Kendo().Grid<T>()
            //    .Name(name)
            //    //.Groupable()
            //    .Pageable(pager => { pager.PageSizes(true); })
            //    .Sortable()
            //    .Scrollable()
            //    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single));


            System.Reflection.PropertyInfo[] properties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
            return(helper.Kendo().Grid <T>()
                   .Name(name)
                   .Columns(columns =>
            {
                foreach (var item in properties)
                {
                    if (item.PropertyType.Name.Equals("String"))
                    {
                        columns.Bound(item.Name).Width(_defaultColumnTypeStringWidth);
                    }
                    else if (item.PropertyType.Name.Equals("Int") || item.PropertyType.Name.Equals("Float") || item.PropertyType.Name.Equals("Double"))
                    {
                        columns.Bound(item.Name).Width(_defaultColumnTypeNumberWidth);
                    }
                    else
                    {
                        columns.Bound(item.Name).Width(_defaultColumnWidth);
                    }
                }
            }));
        }
Example #18
0
        public static MvcHtmlString EnumDropDownListFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TValue> > expression, Expression <Func <TValue> > enumPropertyExpression, string emptyText, object htmlAttributes, Func <DropDownListBuilder, DropDownListBuilder> customize = null)
        {
            var selected = enumPropertyExpression.Compile()();
            var enumType = typeof(TValue);

            if (!enumType.IsEnum)
            {
                throw new ArgumentException("Type is not an enum.");
            }

            if (selected != null && selected.GetType() != enumType)
            {
                throw new ArgumentException("Selected object is not " + enumType);
            }

            var dropDownItemList = Enum.GetValues(enumType).Cast <object>()
                                   .ToDropDownItemList(
                item => htmlHelper.LocalizedEnum((Enum)item).ToString(),
                item => (int)item,
                selected, emptyText);

            var comboBoxBuilder = htmlHelper.Kendo()
                                  .DropDownListFor(expression)
                                  .BindTo(dropDownItemList)
                                  .HtmlAttributes(htmlAttributes);

            if (customize != null)
            {
                comboBoxBuilder = customize(comboBoxBuilder);
            }

            return(MvcHtmlString.Create(comboBoxBuilder.ToHtmlString()));
        }
Example #19
0
        public static MvcHtmlString RenderItensDominioComboBox(this HtmlHelper helper,
                                                               string nome,
                                                               string nomeDominio,
                                                               object htmlAttributes  = null,
                                                               bool isToShowItemValue = false)
        {
            ComboBoxBuilder comboBoxBuilder = helper.Kendo().ComboBox();

            comboBoxBuilder.Name(nome);

            comboBoxBuilder.DataValueField("Vl_Item_Dominio");
            comboBoxBuilder.DataTextField("Dc_Item_Dominio");

            if (htmlAttributes != null)
            {
                comboBoxBuilder.HtmlAttributes(htmlAttributes);
            }

            comboBoxBuilder.DataSource(dataSource =>
            {
                dataSource.Read("ItensDominio", "Dominios", new { nomeDominio = nomeDominio, isToShowItemValue = isToShowItemValue });
            });

            return(MvcHtmlString.Create(comboBoxBuilder.ToHtmlString()));
        }
Example #20
0
        public static TimePickerBuilder VnrTimePickerFor <TModel>(this HtmlHelper <TModel> helper, Expression <Func <TModel, DateTime?> > expression, TimePickerBuilderInfo builderInfo)
        {
            var events = new Action <DatePickerEventBuilderBase>(e =>
            {
                if (!string.IsNullOrWhiteSpace(builderInfo.EventChange))
                {
                    e.Change(builderInfo.EventChange);
                }
            });
            var timePickerBuilder = helper.Kendo().TimePickerFor(expression)
                                    .Enable(builderInfo.Enable)
                                    .Format(builderInfo.Format)
                                    .Events(events);

            if (!string.IsNullOrWhiteSpace(builderInfo.Name))
            {
                timePickerBuilder.Name(builderInfo.Name);
            }
            if (!string.IsNullOrWhiteSpace(builderInfo.Value))
            {
                timePickerBuilder.Value(builderInfo.Value);
            }

            if (!string.IsNullOrWhiteSpace(builderInfo.StyleCss))
            {
                timePickerBuilder.HtmlAttributes(new { style = builderInfo.StyleCss, placeholder = builderInfo.Placeholder });
            }

            return(timePickerBuilder);
        }
Example #21
0
        public static WindowBuilder VnrWindow(this HtmlHelper helper, WindowBuilderInfo builderInfo)
        {
            var windowAction  = new Action <WindowActionsBuilder>(w => w.Close());
            var windowBuilder = helper.Kendo()
                                .Window()
                                .Name(builderInfo.Name)
                                .Width(builderInfo.Width)
                                .Height(builderInfo.Height)
                                .Draggable()
                                .Visible(builderInfo.Visible)
                                .Modal(true)
                                .Title(builderInfo.Title)
                                .Actions(windowAction);

            if (!string.IsNullOrWhiteSpace(builderInfo.LoadContentFrom))
            {
                windowBuilder.LoadContentFrom(builderInfo.LoadContentFrom);
            }
            if (!string.IsNullOrWhiteSpace(builderInfo.Content))
            {
                windowBuilder.Content(builderInfo.Content);
            }
            if (builderInfo.ContentFunc != null)
            {
                windowBuilder.Content(builderInfo.ContentFunc);
            }
            if (!string.IsNullOrWhiteSpace(builderInfo.EvenClose))
            {
                windowBuilder.Events(m => m.Close(builderInfo.EvenClose));
            }
            return(windowBuilder);
        }
Example #22
0
        public static DateTimePickerBuilder VnrDateTimePicker <TModel>(this HtmlHelper <TModel> helper, DateTimePickerBuilderInfo builderInfo)
        {
            var dateTimePickerBuilder = helper.Kendo().DateTimePicker()
                                        .Enable(builderInfo.Enable)
                                        .Format(ConstantFormat.HRM_Format_DayMonthYear_HoursMin)
                                        .TimeFormat(builderInfo.TimeFormat)
                                        .Start(builderInfo.Start)
                                        .Depth(builderInfo.Depth)
                                        .Min(builderInfo.Min)
                                        .Max(builderInfo.Max);

            //.Culture(builderInfo.Culture);

            if (!string.IsNullOrWhiteSpace(builderInfo.Name))
            {
                dateTimePickerBuilder.Name(builderInfo.Name);
            }

            if (!string.IsNullOrWhiteSpace(builderInfo.Value))
            {
                dateTimePickerBuilder.Value(builderInfo.Value);
            }

            if (!string.IsNullOrWhiteSpace(builderInfo.StyleCss))
            {
                dateTimePickerBuilder.HtmlAttributes(new { style = builderInfo.StyleCss, placeholder = builderInfo.Placeholder });
            }

            return(dateTimePickerBuilder);
        }
Example #23
0
        public static AutoCompleteBuilder VnrAutoComplete(this HtmlHelper helper, VnrAutoCompleteInformation autoCompleteInfo)
        {
            Action <ReadOnlyDataSourceBuilder> dataSource = new Action <ReadOnlyDataSourceBuilder>(d =>
            {
                if (!string.IsNullOrWhiteSpace(autoCompleteInfo.Url))
                {
                    d.Read(p => p.Url(autoCompleteInfo.Url).Type(HttpVerbs.Post));
                }
                else if (!string.IsNullOrWhiteSpace(autoCompleteInfo.DataActionName))
                {
                    d.Read(autoCompleteInfo.DataActionName, autoCompleteInfo.ControllerName);
                }
            });

            return(helper.Kendo().AutoComplete()
                   .Filter(FilterType.Contains)
                   .Name(autoCompleteInfo.Name)
                   //.HeaderTemplate(autoCompleteInfo.Headertemplate)
                   .Placeholder(autoCompleteInfo.Placeholder)
                   .Height(autoCompleteInfo.Height)
                   .HtmlAttributes(new { style = "width:" + autoCompleteInfo.Width + "px;" })
                   .DataTextField(autoCompleteInfo.FilterField)
                   .DataSource(dataSource)
                   .Separator(autoCompleteInfo.Separator));
        }
Example #24
0
        public static MvcHtmlString TimePickerCr(this HtmlHelper helper, string id)
        {
            Kendo.Mvc.UI.Fluent.TimePickerBuilder timePicker = helper.Kendo().TimePicker()
                                                               .Name(id);

            return(MvcHtmlString.Create(timePicker.ToHtmlString()));
        }
        KendoGrid <T>(this HtmlHelper helper, string name, string controlerName, string actionName,
                      string primaryKey = "", string filterParams = "", string updateAction = "", string destroyAction = "", int pageSize = 10, string htmlStyle = "") where T : class
        {
            if (string.IsNullOrEmpty(htmlStyle))
            {
                htmlStyle = "width: 100%";
            }
            return(helper.Kendo().Grid <T>()
                   .Name(name)
                   .HtmlAttributes(new { style = htmlStyle })
                   //.Groupable()
                   .Pageable()
                   .Sortable()
                   .Scrollable()
                   .Filterable()
                   .Pageable(pageable => pageable
                             .Refresh(true)
                             .PageSizes(true)
                             .ButtonCount(5)
                             )
                   .Selectable(selectable => selectable.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
                   .Events(e => e.DataBound("onRowBound"))
                   .DataSource(dataSource => dataSource
                               .Ajax()
                               .Read(read => read.Action(actionName, controlerName, new { id = filterParams }))
                               .PageSize(pageSize)
                               .ServerOperation(false)
                               //.Model(model => model.Id(primaryKey))
                               .Update(update => update.Action(updateAction, controlerName))
                               .Destroy(update => update.Action(destroyAction, controlerName))

                               ));
        }
Example #26
0
        public static GridBuilder <T> FullFeaturedGrid <T>(this HtmlHelper helper, string controllerName, Expression <Func <T, object> > modelIdExpression, Action <GridColumnFactory <T> > columns = null) where T : class
        {
            if (columns == null)
            {
                columns = cols =>
                {
                    cols.AutoGenerate(true);
                    cols.Command(c => c.Edit());
                    cols.Command(c => c.Destroy());
                };
            }

            return(helper.Kendo()
                   .Grid <T>()
                   .Name("grid")
                   .Columns(columns)
                   .ColumnMenu()
                   .Pageable(page => page.Refresh(true))
                   .Sortable()
                   .Groupable()
                   .Filterable()
                   .Editable(edit => edit.Mode(GridEditMode.PopUp))
                   .ToolBar(toolbar => toolbar.Create())
                   .DataSource(data =>
                               data
                               .Ajax()
                               .Model(m => m.Id(modelIdExpression))
                               .Read(read => read.Action("Read", controllerName))
                               .Create(create => create.Action("Create", controllerName))
                               .Update(update => update.Action("Update", controllerName))
                               .Destroy(destroy => destroy.Action("Destroy", controllerName))
                               ));
        }
Example #27
0
 public static Kendo.Mvc.UI.Fluent.DatePickerBuilder DatePickerCr(this HtmlHelper helper, string name, string formatDate = _format, string culture = _culture)
 {
     return(helper.Kendo().DatePicker()
            .Name(name)
            .Culture(culture)
            .Format(formatDate));
 }
Example #28
0
        public static ProgressBarBuilder VnrProgressBar(this HtmlHelper helper, ProgressBarBuilderInfo builderInfo)
        {
            var progressBar = helper.Kendo().ProgressBar()
                              .ChunkCount(builderInfo.ChunkCount)
                              .Enable(builderInfo.Enable)
                              .Max(builderInfo.MaxValue)
                              .Min(builderInfo.MinValue)
                              .Name(builderInfo.Name)
                              .Orientation(builderInfo.Orientation)
                              .Reverse(builderInfo.Reverse)
                              .ShowStatus(builderInfo.ShowStatus)
                              .Type(builderInfo.ProgressType)
                              .Value(builderInfo.DefaultValue);

            if (builderInfo.EvenChange != null && builderInfo.EvenChange != string.Empty)
            {
                progressBar.Events(m => m.Change(builderInfo.EvenChange));
            }
            if (builderInfo.EvenComplete != null && builderInfo.EvenComplete != string.Empty)
            {
                progressBar.Events(m => m.Complete(builderInfo.EvenComplete));
            }

            return(progressBar);
        }
Example #29
0
        public static EditorBuilder VnrEditor(this HtmlHelper helper, VnrEditorBuilderInfo builderInfo)
        {
            var editorBuilder = helper.Kendo().Editor()
                                .Name(builderInfo.Name);

            #region Xử lý width, height
            var strStyle = string.Empty;
            if (builderInfo.Width > 0)
            {
                strStyle += "width:" + builderInfo.Width + "px; ";
            }
            if (builderInfo.Height > 0)
            {
                strStyle += "height:" + builderInfo.Height + "px; ";
            }
            if (!string.IsNullOrEmpty(strStyle))
            {
                if (builderInfo.HtmlAttributes == null)
                {
                    builderInfo.HtmlAttributes = new Dictionary <string, object>();
                }
                builderInfo.HtmlAttributes.Add("style", strStyle);
            }
            #endregion

            if (builderInfo.HtmlAttributes != null && builderInfo.HtmlAttributes.Any())
            {
                editorBuilder.HtmlAttributes(builderInfo.HtmlAttributes);
            }
            if (!string.IsNullOrEmpty(builderInfo.Value))
            {
                editorBuilder.Value(builderInfo.Value);
            }
            return(editorBuilder);
        }
Example #30
0
        public static GridBuilder <T> KendoGrid <T>(
            this HtmlHelper helper,
            Expression <Func <T, object> > modelIdExpression,
            Action <CrudOperationBuilder> readOperation,
            Action <CrudOperationBuilder> createOperation  = null,
            Action <CrudOperationBuilder> updateOperation  = null,
            Action <CrudOperationBuilder> destroyOperation = null,
            string gridId = null,
            Action <GridColumnFactory <T> > columns         = null,
            Action <GridToolBarCommandFactory <T> > toolbar = null,
            string editorTemplateName = null)
            where T : class
        {
            var grid = helper.Kendo().Grid <T>()
                       .Name(gridId ?? "data-grid")
                       .Columns(columns ?? GetDefaultColumns <T>(updateOperation, destroyOperation))
                       .ColumnMenu()
                       .Pageable(page => page.Refresh(true))
                       .Pageable(x => x.Refresh(true))
                       .Sortable(x => x.Enabled(true).AllowUnsort(false))
                       .Filterable(x => x.Enabled(true))
                       .Reorderable(x => x.Columns(true))
                       .Resizable(x => x.Columns(true))
                       .ToolBar(toolbar ?? GetDefaultToolbar <T>(createOperation))
                       .Editable(GetEditingSettings <T>(editorTemplateName))
                       .DataSource(GetDataSource(modelIdExpression, readOperation, createOperation, updateOperation, destroyOperation));

            return(grid);
        }
Example #31
0
 public static DropDownListBuilder DropDownListControl(this HtmlHelper helper, string name, string textField, string valueField)
 {
     return(helper.Kendo().DropDownList()
            .Name(name)
            .DataTextField(textField)
            .DataValueField(valueField)
            .HtmlAttributes(new { @class = HtmlInputClass }));
 }
Example #32
0
        public GridFilterBuilder <TModel> WithLookupFilter <TValue>(Expression <Func <TModel, TValue> > expression, IEnumerable <DropDownListItem> dropDownItems, int width = 200, string filterFunction = "RefreshGrid")
        {
            var editorString = htmlHelper
                               .Kendo()
                               .DropDownList()
                               .Name(ExpressionHelper.GetExpressionText(expression))
                               .BindTo(dropDownItems)
                               .Events(events => events.Change(filterFunction))
                               .HtmlAttributes(GetDropDownHtmlAttributes(width))
                               .ToHtmlString();

            var buildRowWithLabel = BuildRowWithLabel(expression, editorString, true, true);

            buildRowWithLabel.AddToInnerHtml(emptyCellBuilder.ToString());
            fluentTagBuilder.AddToInnerHtml(buildRowWithLabel);
            return(this);
        }
 public override string HtmlString(HtmlHelper helper, string nameFormat)
 {
     return helper.Kendo().DropDownList()
         .Name(string.Format(nameFormat, Name))
         .HtmlAttributes(new { @class = "td-filter-input" })
         .BindTo(data)
         .DataTextField(dataFieldText)
         .DataValueField(dataFieldValue)
         .OptionLabel("Все")
         .ToHtmlString();
 }