how do I remove the upload done and change it to "ok"
@(Html.Kendo().Upload().Name("files")
.TemplateId("fileTemplate")
.Multiple(false)
.Messages(m => m.Select("Selecionar Arquivo...").UploadSelectedFiles("Importar").StatusUploading("OK").StatusUploaded("OK"))
.Async(a => a
.Save("SaveAsync", "Util")
.Remove("Remove", "Util")
.AutoUpload(false))
.HtmlAttributes(new { accept = ".xml,.xlsx,.xlsb,.xls" })
.Events(e => e.Error("uploadError").Complete("carregarGridErros")))
Hi,
I am creating a Kendo grid which involves using a Dropdown List for certain cells. I have created the Editor Template for the dropdown inside the Shared/EditorTemplates folder called DropdownList.cshtml. The dropdown list works as intended, I have inline editing enabled and I am able to update the values via Ajax.
Here's the column in the initial grid:columns.Bound(e => e.Balance).Width(40).Title("Balance").ClientTemplate("<span>#=getIcon(Balance)#</span>").EditorTemplateName("DropdownList");
The problem occurs when I try to use that same EditorTemplate called DropdownList in a hierarchy grid, just below its predecessor. The subgrid is configured using .ClientDetailTemplateId("template"), where the child grid is titled .Name("tracking-grid_#=id#"), and linked using .ToClientTemplate(). (As shown in the Telerik demonstration here.).
As soon as I add the .EditorTemplateName("DropdownList"); to the following line, the grid does not load and I receive the following error in the browser console: Uncaught Error: Invalid template
columns.Bound(e => e.Balance).Width(40).Title("Balance").ClientTemplate("<span>#=getIcon(Balance)#</span>").EditorTemplateName("DropdownList");
** Note: I know these columns have the same name, but they are being taken from different datasets. It just so happens to appear in both grids.
Searching for solutions, I made sure to try escaping all (#) hash characters with \\ wherever they appear, and I tried creating an alternate file in the EditorTemplates folder so they would be distinct. The grid still breaks and fails to render each time from just this one line.
I found a similar discussion here that I thought would help me, but no luck.
I understand that I am trying to use the same Editor Template in two separate grids. But I really need to use this dropdownlist in both. Is MVC not able to use the same editor template in nested grids like this, or is there something else I'm missing?
Thanks.
hello,
I have students kendo grid in my MVC project with below settings . I’d like to mark dirty flag on the certain cells programmatically. But I didn’t see dirty flag (red triangle on let top corner) on the cell after I run js code. Could someone help me out? Thanks!
.Editable(editable => editable.Mode(GridEditMode.InCell))
.ColumnMenu()
.Resizable(resizable => resizable.Columns(true))
.Pageable(p => p.PageSizes(new int[] {25, 50, 100 }))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.PageSize(15)
...
Run JavaScript when button click:
$("#markDirty").click(function (e) {
e.preventDefault();
var grid = $("#studentGrid").data("kendoGrid");
var data = grid.dataSource.data();
for (var i = 0; i < data.length; i++) {
if (data[i].ClassName == "MVC") {
data[i].ClassName = "MVC 5.0";
data[i].dirty = true;
}
}
grid.refresh();//didn't see the data change without this line.
});
Hi,
I have a Kendo Grid with 20columns in that i have 12 columns as months. in one column am getting data like below attached image format (1/0,2/1,3/2). in ClientFooterTemplate am displaying sum of this column. here i want to apply same logic all 12 months.
below is my code.
columns.Group(group => group.Title("200<hr> Jan").Columns(Jan =>
{
Jan.Bound(p => p.Jan_A).Width(60).Filterable(false).Editable("function(dataItem) {if (((new Date).getMonth() + 1) <= 1) {return true}else return false;}").ClientFooterTemplate("#=kendo.toString(conditionalSum(), '0,0')#").HtmlAttributes(new { style = "text-align: center;" }).HeaderHtmlAttributes(new { @class = "col-sm-1 col-md-1 col-lg-1 col-xl-1 ", style = "white-space: normal;text-align: center;" }).Title("A / F");
}));
below is Javascript code
function conditionalSum() {
this function is working fine for only month. how can i use same function for remaining 11 columns.
Can you tell me how to add a Hyperlink column to a MVC ASP.NET Grid?
I've tried everything i could find and none work.. JIRA_Ticket is the display value, and Service Desk holds the Hyperlink i want to open a new window with. It's possible i'm just not googling it right.. I'm fairly new to this so sorry if this is a dumb question.
.Columns(columns =>I just want to be able to click on the JIRA ticket column in the grid and open the servicedesk link in the model.
If this is not possible, happy to go with an action button..
Any help appreciated
The grid and popup work fine except the values I enter in create mode do not get passed back to my controller. Looking at the JS Console shows no errors. Monitoring the create process in Fiddler also shows no values being passed, although my form elements do show.
While debugging, the model in my controller is empty.
Here's the grid definition:
@(Html.Kendo().Grid<MyApp.Domain.Entities.TaktInterruptionViewModel>()
.Name("Interruptions")
.Columns(columns =>
{
columns.Bound(i => i.TaktInterruptionId).Hidden().IncludeInMenu(false);
columns.Bound(i => i.DateCreated).Title("Date").Width(75).Format("{0:d}");
columns.Bound(i => i.ActionCount).Title("Actions").Width(50).Hidden(true);
columns.Bound(i => i.MeetingType).Title("Meeting Type").Width(100).Hidden(true);
columns.Bound(i => i.AreaName);
columns.Bound(i => i.TypeName);
columns.Bound(i => i.Responsible);
columns.Bound(i => i.Description).Width(300);
columns.Bound(i => i.Interruption).Width(75).Hidden(true);
columns.Bound(i => i.TaktMissed).Title("Missed").Width(75);
})
.ClientDetailTemplateId("ActionsTemplate")
.ToolBar(toolbar => toolbar.Create().Text("Add Interruption"))
.Editable(edit => edit.Mode(GridEditMode.PopUp).TemplateName("Create").Window(w => w.Title("Interruption").Name("addInterruption").Modal(true)))
.DataSource(datasource => datasource.Ajax()
.Model(model => model.Id(p => p.TaktInterruptionId))
.ServerOperation(false)
.PageSize(5)
.Create(create => create.Action("Create", "Home"))
.Read(read => read.Action("GetInterruptions", "Home")))
.Groupable()
.Pageable()
.Sortable()
.Filterable()
.ColumnMenu()
.Selectable(s => s.Mode(GridSelectionMode.Multiple))
.Reorderable(reorder => reorder.Columns(true))
.Resizable(resize => resize.Columns(true))
.Events(events => events.Change("displayChart"))
)
My create editor template is as follows:
@model MyApp.Domain.Entities.TaktInterruptionViewModel
@{
ViewBag.Title = "Index";
}
<div class="span-14" style="padding: 10px;">
@Html.ValidationSummary(true)
<hr class="space" />
<div>
@Html.LabelFor(model => model.DateCreated)<br />
@(Html.Kendo().DatePicker().Name("DateCreated").Value(DateTime.Today))
<br />
@Html.ValidationMessageFor(model => model.DateCreated, null, new { style = "color:red;" })
</div>
<hr class="space" />
<div class="span-7">
@Html.LabelFor(model => model.AreaId)<br />
@(Html.Kendo().DropDownListFor(model => model.AreaId)
.Name("AreaId")
.HtmlAttributes(new { style = "width:200px" })
.OptionLabel("Select Area...")
.DataTextField("AreaName")
.DataValueField("AreaId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetAreas", "Area");
});
})
)
<br />
@Html.ValidationMessageFor(model => model.AreaId)
</div>
<div class="span-6">
@Html.LabelFor(model => model.TaktInterruptionTypeId)<br />
@(Html.Kendo().DropDownListFor(model => model.TaktInterruptionTypeId)
.Name("TaktInterruptionTypeId")
.HtmlAttributes(new { style = "width: 200px" })
.OptionLabel("Select Type...")
.DataTextField("TypeName")
.DataValueField("TaktInterruptionTypeId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetTypes", "Area").Data("filterTypes");
}).ServerFiltering(true);
})
.Enable(false)
.AutoBind(false)
.CascadeFrom("AreaId")
)
<br />
@Html.ValidationMessageFor(model => model.TaktInterruptionTypeId, null, new { style = "color:red;" })
</div>
<hr class="space" />
<div class="span-11">
@Html.LabelFor(model => model.Description)<br />
@Html.TextAreaFor(model => model.Description, new { @class = "multi-line" })
<br />
@Html.ValidationMessageFor(model => model.Description, null, new { style = "color:red;" })
</div>
<hr class="space" />
<div class="span-5">
@Html.LabelFor(model => model.Interruption)<br />
@(Html.Kendo().NumericTextBox().Name("Interruption").Format("#.0").Value(0))
<br />
@Html.ValidationMessageFor(model => model.Interruption)
</div>
<div class="span-6">
@Html.LabelFor(model => model.TaktMissed)<br />
@(Html.Kendo().NumericTextBox().Name("TaktMissed").Format("#.0").Value(0))
<br />
@Html.ValidationMessageFor(model => model.TaktMissed)
</div>
<hr class="space" />
<div>
@Html.LabelFor(model => model.Responsible)<br />
@Html.EditorFor(model => model.Responsible, new { @class = "k-input k-textbox" })
<br />
@Html.ValidationMessageFor(model => model.Responsible, null, new { style = "color:red;" })
</div>
<hr class="space" />
<hr class="space" />
</div>
<script type="text/javascript">
function filterTypes() {
return {
AreaID: $("#AreaId").val()
};
}
</script>
And my controller create method is:
[HttpPost]
public ActionResult Create([DataSourceRequest] DataSourceRequest request, MyApp.Domain.Entities.TaktInterruptionViewModel taktInterruption)
{
try
{
if (ModelState.IsValid)
{
// code removed for brevity
}
return Json(ModelState.ToDataSourceResult());
}
catch(Exception ex)
{
// code removed for brevity
}
}
If I remove my editor template from the equation and allow Kendo to do the popup, the information is passed to my controller; however, I want to control the layout of the popup and I also have cascading drop-downs (that work), thus the editor template.
My question is why aren't my values that I enter in the popup being passed to my controller?
Hi,
I have a grid where amongst other columns, I have two columns which are related - in the first column I select from a list of available options and based on the value selected here, I want to apply a filter to a foreign key column elsewhere in the grid.
So for example if I have a column for "Company ID" with values [1, 2, 3, 4,5] and an FK column "Category", the values bound to the "Category" column are ID/Text pairs for all possible categories, but I'd like to filter that down based on a 3rd "CompanyID" value.
It seems that no matter how I configure the FK column, the underlying data source only ever has the ID/Text values so any attempt at filtering it down based on the CompanyID column doesn't work. Even if my bound values/remote data source returns objects with the required fields for filtering, they get dropped when the FK dropdown list's data source is created.
Is something this even possible to achieve with the grid? If so any pointers would be much appreciated.