or
@(Html.Kendo().TreeView() .Name("FolderTree") .TemplateId("treeviewtemplate") .Events(e => e .Select("tvOnSelect") .DataBound("tvOnDataBound") .DragEnd("tvOnDragEnd") ) .BindTo(Model.Folders, (Kendo.Mvc.UI.Fluent.NavigationBindingFactory<TreeViewItem> mappings) => { mappings.For<PriMate.Web.Models.FolderModel>(bound => bound.ItemDataBound((node, item) => { node.Text = item.name; node.Id = item.id.ToString(); node.HasChildren = false; }) .Children(item => item.folders)); }))# if (item.hasChildren) { # <input type="image" src="Content/images/trash.png" class="delete-node" onclick="return confirmDelete('folder', '${item.text}', '${item.id}')" title="delete ${item.text}"># } #@(Html.Kendo().DropDownListFor(model => model.Table) .OptionLabel(@GeneralConstants.SELECT_VALUE) .HtmlAttributes(new { style = "width: 200px", id = "TableDropDown", required = "required" }) .SelectedIndex(1) .Enable(false) .AutoBind(true) .Name("Table") .DataTextField("Name") .DataValueField("TableID") .Events(e => { e.Change("onChange"); e.DataBound("bound"); }) .DataSource(source => { source.Read(read => { read.Action("GetRegExpressions", "Pattern"); }) .ServerFiltering(true); }) )@(Html.Kendo().Grid(Model) .Name("Grid") .HtmlAttributes(new { style = "height:450px;font-size:.85em;" }) .Columns(columns => { columns.Template(e => { }).ClientTemplate(" ").Width(30).HtmlAttributes(new { style="vertical-align: middle; text-align: center" }); columns.Bound(p => p.Id).Width(60); columns.Bound(p => p.Title).Width(250); columns.Bound(p => p.AssignedUser).Width(120); columns.Bound(p => p.Status); columns.Bound(p => p.Priority); columns.Bound(p => p.Category); columns.Bound(p => p.Tier); columns.Bound(p => p.LastModifiedAsString).Title("Last Modified").Width(120); }) .ClientRowTemplate( "<tr>" + "<td>" + "<img style ='margin-top:5px;' src='" + Url.Content("~/Images/") +"#:data.Icon#' alt='#:data.Icon#' />" + "</td>" + "<td width='60'>#: Id #</td>" + "<td width='250'>#: Title #</td>" + "<td width='120'>#: AssignedUser #</td>" + "<td>#: Status #</td>" + "<td>#: Priority #</td>" + "<td>#: Category #</td>" + "<td>#: Tier #</td>" + "<td>#: LastModifiedAsString #</td>" + "</tr>" ) .Pageable() .Sortable() .Scrollable() .Groupable() .Filterable(filterable => filterable .Extra(false) .Operators(operators => operators .ForString(str => str.Clear() .StartsWith("Starts with") .IsEqualTo("Is equal to") .IsNotEqualTo("Is not equal to") )) ) .Selectable(selectable => selectable .Mode(GridSelectionMode.Single)) .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Read(read => read.Action("Get", "Grid")) ) .Events(e => e.Change("onChanged")) )<script type="text/javascript"> function onChanged(arg) { var selected = this.select(); var wiId = this.dataItem(selected).Id; window.location = '../WorkItem/Edit?Id=' + wiId; } var myGrid; $(function () { myGrid = $('#Grid').data('kendoGrid'); }); setInterval(DoWork, parseInt(@ViewBag.RefreshInterval)); function DoWork() { myGrid.dataSource.read(); }</script>Hello I'm trying to validate the dropdownlist and it is not validating.. Below is the code i'm trying.. DropDownlist and Date column is required field and when click the button it populate the grid view.. Even though I'm not selecting dropdownlist value it is not validating and populating the empty grid.
@using DWH.WEB.Models.ViewModel@{ ViewBag.Title = "test";}<div style="background-color: #E3F1F7; text-align: left; vertical-align: middle;"><h2>>>>test</h2></div><table><tr><td><div class="section"style="width: 350px;"> <h4>Select Entity code</h4> <div id="ValidateMyContents"> @(Html.Kendo().DropDownList() .Name("dropdownlist") .HtmlAttributes(new { style = "width:320px" }) .DataTextField("Text") .DataValueField("Value") //.OptionLabel("Please Select") .OptionLabel(new { Text = "Select Entity", Value = 0 }) .DataSource(source => { source.Read(read => { read.Action("GetEntityCode", "GLFINBAL"); }); }) ) <span class="k-invalid-msg" data-for="dropdownlist"></span> </div> </div></td><td><div class="section"style="width: 250px;"> <h4>Select FiscalYear</h4> @(Html.Kendo().DatePicker() .Name("yearpicker") .Start(CalendarView.Decade) .Depth(CalendarView.Decade) .Format("yyyy") .Value("2014") .HtmlAttributes(new { style = "width:250px" }) ) </div></td><td><button id="showGrid" class="k-button" type="button" style="width: 150px">View Report</button><br /> <span id="status"></span></td></tr><tr><td colspan="3"></td></tr></table><script> $("#showGrid").click(function (e) { e.preventDefault(); $("#status").text(""); var validator = $("#ValidateMyContents").kendoValidator().data('kendoValidator'); if (validator.validate()) { $("#status").text("Entity was selected"); } else { $("#status").text("Entity was not selected"); } $("#AjaxGrid").data("kendoGrid").dataSource.read(); $("#AjaxGrid").css("display", "block"); });// $("#showGrid").click(function () {// $("#AjaxGrid").data("kendoGrid").dataSource.read();// $("#AjaxGrid").css("display", "block");// }); function additionalInfo() { var info = $("#dropdownlist").data("kendoDropDownList").value(); var yearpicker = $("#yearpicker").data("kendoDatePicker").value(); return { dropdownlist: info, yearpicker: yearpicker } } </script>@(Html.Kendo().Scheduler<iMail.Web.Models.TaskViewModel>() .Name("scheduler") .Date(DateTime.Now) .StartTime(new DateTime(2013, 6, 13, 7, 00, 00)) .Height(600) .Views(views => { views.DayView(); views.WeekView(); views.MonthView(); views.AgendaView(agenda => agenda.Selected(true)); }) .Selectable(true) .Timezone("Etc/UTC") .Editable(editable => { editable.TemplateName("_EditorTemplatePartial"); }) .DataSource(d => d .Model(m => { m.Id(f => f.TaskID); m.Field(f => f.Title).DefaultValue("No title"); m.RecurrenceId(f => f.RecurrenceID); }) .Events(e => e.Error("error_handler")) .Read("TasksRead", "Dashboard") .Create("Tasks_Create", "Dashboard") .Destroy("Tasks_Destroy", "Dashboard") .Update("Tasks_Update", "Dashboard") ) )