We are using an editable grid with InCell editing in Batch mode.
We have a bool column with a checkbox using a client template:
columns.Template(c => c.Active)
.ClientTemplate("<input type=\"checkbox\" name=\"chkActive\" id=\"chkActive\" value=\"#= Active #\" #= Active?'checked':'' # />")
.Title("Select")
.HeaderHtmlAttributes(new { style = "text-align:center" })
.Width(40).HtmlAttributes(new { style = "text-align:center" });
It seems that we aren't getting two way biding though. We check some check boxes, then scroll down so a read occurs to get the next page of records, but when we scroll up the check boxes are no longer checked.
Is this not the correct way to bind a checkbox to a bool column in the editable grid?
Hi,
What is the best way to group by a field in a ListView?
I'd like to have something along the lines of this
Species: Human
1: Toby
2: Rob
Species: Dog
3: Harry
4: Rover
Species: Cat
5: Tickles
The model schema is as below
ID Name Species
1 Toby Human
2 Rob Human
3 Harry Dog
4 Rover Dog
5 Tickles Cat
<script type="text/x-kendo-tmpl" id="template"> <div class="person"> <div class="id">#:ID#</div> <div class="name">#:Name#</div> </div></script><div id="persons"> @(Html.Kendo().ListView<Person>() .Name("persons") .TagName("div") .ClientTemplateId("template") .DataSource(ds => ds .Model(m => m.Id(p => p.ID)) .Read(r => r.Action("PersonsRead", "Home")) .Group(g => g.Add(p => p.Species)) ))I managed to get as far as the above, but this throws an error as it is passing the Species field and value to the client template from the Group method.
Any ideas?
I have to install kendo mvc in vs 2012 (just moved from 2010 to 2012) however I cannot see where I can get the msi installer for the latest version.
Please advise.
p.s the notes indicate that one should copy the css and js and that should do it - however - this does not help when you want to have the Telerik menu item in Visual studio installed or the matter of the Kendo MVC dlls being installed et al.
As well - I do need the Telerik menu options installed in Visual Studio to allow for future updates as well.
Please advise.
I have a form with a drop down list inside of it. When the form is posted I want the data in the drop down list to be written into Class B, which is an attribute of Class A on the MVC side.
Can this be done? Is there any way to format or pull the data from the Drop down list directly into Class B, which is inside of Class A? Is there some way to map the input from the drop down list to this element?
Seeing an odd issue trying to setup some inline editing using the Grid controller. The Grid displays correctly and functions correctly until I try to perform an edit. When I click the edit button, make edits and then press update, the line comes back with empty values.
Upon inspection, the model being passed to the controller ActionResult is null (expect for ID and date). Code below. Took a look at some of the null threads and not seeing a common denominator. Any thoughts:
Grid Control:
@(Html.Kendo().Grid(Model) .Name("commissionGrid") .Columns(columns => { columns.Bound(p => p.CommissionId); columns.Bound(p => p.TenantId); columns.Bound(p => p.SimpleName); columns.Bound(p => p.StartDate); columns.Bound(p => p.CustomerName); columns.Bound(p => p.CustomerNumber); columns.Command(command => { command.Edit(); }).Title("Commands"); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Navigatable() .Sortable() .DataSource(dataSource => dataSource .Ajax() .Batch(true) .PageSize(10) //.ServerOperation(false) .Model(model => model.Id(p => p.CommissionId)) .Update(update => update.Action("EditingInline_Update", "Commissions")) ) )Controller:
[AcceptVerbs(HttpVerbs.Post)] public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request, CommissionViewModel commissionViewModel) { if (commissionViewModel != null && ModelState.IsValid) { using (var test = new CommissionContext()) { try { var entity = new Commission(); entity.CommissionId = commissionViewModel.CommissionId; entity.CustomerName = commissionViewModel.CustomerName; entity.CustomerNumber = commissionViewModel.CustomerNumber; entity.SimpleName = commissionViewModel.SimpleName; entity.StartDate = commissionViewModel.StartDate; entity.TenantId = commissionViewModel.TenantId; test.Commissions.Attach(entity); test.Entry(entity).State = EntityState.Modified; test.SaveChanges(); } catch (System.Data.Entity.Validation.DbEntityValidationException v) { Console.WriteLine("Exception is {0}", v); } } } return Json(new[]{commissionViewModel}.ToDataSourceResult(request, ModelState)); }
Simple use case; a pretty common one I would assume:
I have more than one kendo button displayed within an MVC view. When one of the buttons fires the "submit" event, I want to be able to grab a handle on which button fired the submit from within my controller. I had assumed that you could assign "button" to the name attribute and then determine through the button's "value" property which button fired the event.
The controller signature would look like this:
[HttpPost]
public ActionResult(string button) { determine course of action based on button's value property...}
I'm actually taken back at the fact that one of the most fundamental uses of the input button type is simply not given any means to do this simply. Of course, I could be blind and missing something, but I've searched forums and Telerik documentation and found little if anything on performing this basic task.
Thanks!