I have a partial view that contains a TabStrip and each that contains a grid. The view works, it's currently in a different page and I'd like to move it to a kendo window.
I've moved it to a kendo window and the window displays great.
Here's the code that generates my window (please note the variable names have been changed for this).
var window = $(
"#window"
).kendoWindow({
content: {
url:
"/Case/CaseDetail"
,
data: {
Daid: Daid,
CaseID: CaseID,
RecordID: RecordID,
CanUserView: cuv,
OffenseCount: OffenseCount,
CoDefendantCount: CoDefendantCount,
VWCount: VWCount,
InternalProcessCount: InternalProcessCount,
ChargeDispositionCount: ChargeDispositionCount,
SentenceCount: SentenceCount,
OtherCaseCount: OtherCaseCount
}
},
actions: [
"Pin"
,
"Minimize"
,
"Maximize"
,
"Close"
],
// close: onClose
});
window.kendoWindow().data(
"kendoWindow"
).center().open()
The window appears and the tabs are visible, the content of the 1st tab is loaded via an AJAX call that is never executed (so no content) and none of the tabs are functional when I click on it.
When I look at the page source I can see that the window was rendered as text and all associated javascript is actual text and not, all the scripts related seem to be escaped, here's an example of some rendered content:
<
script
type
=
"text/javascript"
>
function ProcessErrorO(args) {
ProcessError(args, 'O_grid_' + '#= RecordID #');
}
<\/script>
Any help would be appreciated.
Thanks
I had a subcription 5 years ago and have decided to renew my subscription to get the latest version of Kendo for MVC. Our code uses bootstrap as well as Kendo, with JQuery. I was expecting to be able to upgrade all of these to their latest versions. However, I notice that the JQuery file used by Kendo is still 1.12.4, but Visual Studio is referenceing 3.4.1 by default.
Is it possible to ditch 1.12.4 and kendo work with 3.4.1?
Hello everyone,
It's possible to apply a filter on one field automatically? When I load the page I want one filter applied without the user have to do it each time. Of course he can remove it.
See attachment.
Hello, with my code below I want to populate the dropdown and the grid(with all rows), then if the user makes a selection in the dropdown I want the grid to be refreshed with the filtered rows. The NewPartsRead controller action does return the filtered rows, but the grid does not rebind to the filtered rows returned.
What am I doing wrong?
Index:
@using (Html.BeginForm())
{ <div class="demo-section k-content" style="padding:20px;">
@(Html.Kendo().DropDownList()
.Name("EngMake")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(Model.EngMakeList)
.SelectedIndex(0)
.OptionLabel("Select Engine Manufacturer")
.HtmlAttributes(new { style = "width:300px" })
.Filter(FilterType.Contains)
)
</div>
@(Html.Kendo().Grid(Model.NewParts)
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.EngDescription);
columns.Bound(p => p.PartType);
columns.Bound(p => p.EngYear);
columns.Bound(p => p.EngCylinders);
columns.Bound(p => p.EngBore);
columns.Bound(p => p.PartYears);
columns.Bound(p => p.Partieb);
columns.Bound(p => p.PartNotes);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Index", "NewPartsRead"))
)
)
}
Controller:
public class NewPartsController : Controller
{
// GET: NewParts
public ActionResult Index()
{
var model = new NewPartsModel();
return View(model);
}
[HttpPost]
public ActionResult NewPartsRead(NewPartsModel newPartsModel)
{
newPartsModel.NewParts = newPartsModel.NewPartsRead(newPartsModel.EngMake);
return Json(newPartsModel.NewParts);
}
}
Model:
protected readonly NewPartsProvider newPartsProvider = new NewPartsProvider();
public string EngMake { get; set; }
public List<DataObjects.NewPart> NewParts { get; set; }
public List<SelectListItem> engMakeList = new List<SelectListItem>();
public IEnumerable<SelectListItem> EngMakeList { get; set; }
public NewPartsModel()
{
foreach (var engMake in newPartsProvider.GetEngMakeList())
engMakeList.Add(new SelectListItem() { Text = engMake, Value = engMake });
EngMakeList = engMakeList;
NewParts = newPartsProvider.GetNewParts();
}
public List<DataObjects.NewPart> NewPartsRead(string engMake)
{
List<DataObjects.NewPart> NewParts = new List<DataObjects.NewPart>();
NewParts = newPartsProvider.GetNewPartsByMake(engMake);
return NewParts;
}
Hello,
@(Html.Kendo().Grid<
Myproject.Areas.Maintenance.ViewModels.EquipementsInterventions.EquipementInterventionModel
>()
.Name("EquipementIntervention")
.Columns(columns =>
{
columns.Bound(p => p.NoReference).Width(60);
columns.Bound(p => p.DateIntervention).Format("{0:yyyy-MM-dd}").Width(60).HtmlAttributes(new { style = "text-align:center" });
})
.ToolBar(toolBar =>
{
toolBar.Create();
toolBar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.HtmlAttributes(new { style = "font-size:11px;height: 300px;" })
.Scrollable()
.Selectable(s => s.Enabled(false))
.Pageable(pageable => pageable
.Refresh(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.PageSize(100)
.Model(model =>
{
model.Id(field => field.NoEquipementIntervention);
model.Field(field => field.NoReference).DefaultValue("Test");
model.Field(field => field.DateIntervention).DefaultValue(System.DateTime.Now);
})
.Read(read => read.Action("Read", "Equipements", new { id = Model.EquipementId }))
.Create(create => create.Action("Create", "Equipements", new { id = Model.EquipementId }))
.Update(update => update.Action("Update", "Equipements"))
.Destroy(destroy => destroy.Action("Destroy", "Equipements"))
)
)
I try to set a default value when I add a new item in my grid. Even with a hard coded value like "Test". I have the same situation with a DateTime? field until I remove the ?. Any idea about the NoReference (string) field?
The model :
[Key]
public Guid NoId { get; set; }
[Required]
public string NoReference { get; set; }
[UIHint("Date")]
[Required]
public DateTime DateIntervention { get; set; }
The Grid :
THANK A LOT TO EVERYONE.
Hello, I was wondering if it was possible to to the use DateRangePicker for selecting a range of months instead of days. I currently have the following code:
@(Html.Kendo().DateRangePicker()
.Name("MonthlyDatePicker")
.HtmlAttributes(new { style = "width: 100%" })
.Events(e => e.Change("onMonthlyChange"))
.Start("year")
.Depth("year")
.Format("MM yyyy")
)
This code appears the way I want it to but does not allow the user to select a month. Any help is much appreciated. Thanks
Hi,
How do we set the series colours on an AJAX MVC Bar chart.
there is an option to set the colors but doesnt seem to matter what is entered nothing works
@(Html.Kendo().Chart<CML.Models.TopRequestersSample_Result>()
.Name("TopRequesters")
.SeriesColors()
.Title("Top 10 Requesters by Sample Count")
.Legend(legend => legend.Position(ChartLegendPosition.Bottom))
.DataSource(ds => ds.Read(read => read.Action( "GetTopRequesters","Dash" ) ))
.Series( s => { s.Bar( a => a.Total ); } )
.CategoryAxis(ca => {
ca
.Categories( a => a.DisplayName )
.Name( "Requester" );
})
I used the solution (slightly modified for my use case) referenced in the docs to add a new row when tabbing out of the last editable column in the last row. However, when the new row is added, the changes made to that last editable cell are lost. How do I prevent that from happening?
Here's my code. The "return false;" was necessary to prevent the focus going to the second column of the new row. The undesired behavior is occurring whether or not I include it.
$(document).ready(
function
() {
var
grid = $(
"#ReceivingReportGrid"
).data(
"kendoGrid"
);
grid.tbody.on(
"keydown"
,
function
(e) {
if
(e.keyCode == 9) {
if
($(e.target).closest(
'td'
).is(
':nth-last-child(2)'
) && $(e.target).closest(
'tr'
).is(
':last-child'
)) {
grid.addRow();
return
false
;
}
}
});
});
I have 2 comboBox(s) on a grid. When the user clicks the edit button, I want the values that are in the comboBox to stay, currently they blank out. Why is it doing this, and what's the simple solution.