I'm trying to use the Telerik MVC TreeView control with checkboxes in a form. This form is use to create and modify my view Model to recover the user informations (in particular categories selection).
The treeview control shows two levels.
In case of creation, the treeview control must expand all levels.
In case of modify, the treeview control must shows the checkboxes populate in database.
How retrieve the selection of treewiew control in my view model ? I would like to retrieve the selection of treeview control in controller.
Do you have a sample code to explain that ? The demo of treewiew control doesn't explain this binding type of remote data. My treeview control is not make on demand.
My form looks like this :
@model DigitalVM
@using (Html.BeginForm("saveCampaign", "Digital", FormMethod.Post)) { @Html.AntiForgeryToken() <!-- Champs cachés --> @Html.HiddenFor(model => Model.ID) <div class="row 1"> <div class="form-group col-xs-12 col-md-6 Libelle"> @Html.LabelFor(model => model.Libelle) <div> @(Html.Kendo().TextBoxFor(model => model.Libelle) .HtmlAttributes(new { style = "width:100%" }) ) @Html.ValidationMessageFor(model => model.Libelle, "", new { @class = "text-danger" }) </div> </div> <!-- Libelle --> <label>Categories</label> <div class="form-group col-xs-12 col-md-6 Diffusion"> @( Html.Kendo().TreeView() .Name("Categories") .Checkboxes(checkboxes => checkboxes //.Name("IsChecked") .CheckChildren(true) ) .BindTo(Model.ModelTree, mappings => { mappings.For<ModelTree>(binding => binding.ItemDataBound((item, modelItem) => { item.Id = modelItem.id; item.Text = modelItem.Name; item.Expanded = modelItem.Expanded; item.Checked = modelItem.Checked; }) .Children(category => category.Children)); }) .Events(ev => ev.Check("onCheck")) ) </div> </div> <!-- row 1 --> <div style="padding-top: 2em;"> <h4>Status</h4> <p id="result">No nodes checked.</p> </div> <div><span class="icon icon-lock"> @PortailMR.Resources.Shared.Shared.RequiredFields</span></div> <div>@Html.ValidationMessage("CustomError", new { @class = "text-danger" })</div> <div class="form-group gbuttons"> <div class="k-edit-buttons text-right"> @*<input type="submit" value="@PortailMR.Resources.Shared.Shared.Buy.ToUpper()" title="Buy" class="icon icon-shopping-basket k-button" />*@ @(Html.Kendo().Button() .Name("Commander") .Content("Liste insertion") .Icon("icon icon-next2") .HtmlAttributes(new { @type = "submit", @onClick = "abortEvtUnload(true)" })) @Html.ActionLink(" " + @PortailMR.Resources.Shared.Shared.Cancel, "Index", "Digital", null, new { @class = "k-button k-button-icontext k-grid-cancel", @onClick = "abortEvtUnload(true)" }) </div> </div> <!-- gbuttons --> }My Controller looks like this :
[Authorize] [ValidateAntiForgeryToken] [HttpPost] //public ActionResult SendCommand(CommandeVM currentOffre) // OK public ActionResult saveCampaign(DigitalVM model) { try { if (ModelState.IsValid) { writeLog(MethodBase.GetCurrentMethod(), "Start", "Info"); // SAVE Model in DATABASE //var connectManager = ConnectManagers.FirstOrDefault(mng => mng.Product == model.Version); return View("index"); } return View("_TreeView", model); } catch (BusinessException bex) { SetModelError(MethodBase.GetCurrentMethod(), bex); return View("ErrorBusiness", "_Layout3", new HandleErrorInfo(bex, "Offre", "Index")); }My View model looks like this :
public class ModelTree{ public string id { get; set; } public string Name { get; set; } public bool Checked { get; set; } public bool Expanded { get; set; } public IList<ModelTree> Children { get; set; } public ModelTree Parent { get; set; }}public class DigitalVM{ public int ID { get; set; } public String Libelle { get; set; } public IEnumerable<ModelTree> ModelTree { get; set; }}Best regards,
Steph.

I've been fighting with a solution - I have to take a flat file, sometimes 200 mb or larger and and display that in a grid.
Stripping the data from the file is a snap using any one of several methods, but getting into a useful object the Grid can use becomes a real time-crusher.
The raw data is comma-delimited text with headers.
Is it possible to feed a csv into the grid? If so, how?
I can't provide sample code because of security and time constraints.
The most promising approach has been query the the target file using OleDb classes including a OleDbDataReader. Reading a 400k records file into a data table takes about 20 seconds give or take. Applying that to a Grid just blows everything out of the water. Virtual scrolling doesn't help. I simply can't get a large file to display in your grid helper.
Grid for JS doesn't work any better.
Can the Grid actually display a datasource of that size in a reasonable amount of time? Like less than a minute?
I have set up editor to use br instead of p for new line.
The problem I encounter is <br class="k-br"> tag is added in some situation whene ver the user select and apply the font as well.
Because of adding it automatically by the editor, when I get the editor value using value method, the line break is missing.
So, how can I set up not to add automatically line break with k-br class? Or how can I set up not to strip off br tag?
Thanks in advanced.
Kai
Setup: Master-Detail with TabStrip and Grid.
Inside a TabStrip item, which is inside a ClientDetailTemplate of a Grid, I need to have an editable Grid.
The Model for the ClientDetail contains 20 columns, but only three of them must be editable, so I want to put these three columns in an editable Grid. I want to display the rest of the (non-editable) columns in a <div><ul><li> setup, so I can style it in a multi column vertically setup for better readability (putting them as readonly columns inside the Grid would cause a huge horizontal layout).
Is there a way to bind the <li> #= items # </li> to the datasource that is bind to the Grid inside the TabStrip? It looks like I can only bind to the data that is in the Master that contains the ClientDetailTemplate.
The detail data inside the Grid, which is inside the TabStrip item, has its own datasource and this is working as expected. I just need to know how to bind the remaining values to some HTML.
TIA

We are using the grid to display forecast data. it has about 15 rows. In all but two rows, we are doing custom editing (launching another screen to edit values). We use a column with our custom buttons to do launch the secondary screen.
In two of the rows, we would like to have in-line editing. We'll use the same custom buttons to do this. However, we cannot find a way to programmatically put a row into in-line editing (EDIT MODE). Is there a way to do this? All we are able to do is to make the entire grid in-line editable and that is not what we desire.
TIA!
--- xavier

How can I correctly associate the label generated by Html.LabelFor() with my MVC Kendo DropDownListFor(). It seems like it should work but is not read by the screen reader, perhaps due to the hidden input field.
<div class="input-block-level">
@Html.LabelFor(m => m.BirthdayMonth, new {@class = "col-md-5 control-label"})
<div class="col-md-3">
@(Html.Kendo().DropDownListFor(m => m.BirthdayMonth)
.Name("BirthdayMonth")
.OptionLabel("Month")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>
{
new SelectListItem {Text = "01 - Jan", Value = "1"},
new SelectListItem {Text = "02 - Feb", Value = "2"},
[...etc...]
new SelectListItem {Text = "11 - Nov", Value = "11"},
new SelectListItem {Text = "12 - Dec", Value = "12"}
})
.HtmlAttributes(new {@class = "form-control", style = "width:100px"})
.Deferred()
)
</div>
</div>
Thanks,
Gary Davis
Hello - I expect what I want to do is not supported. I that it he case, then I'll abandon this cool idea I have and not use the kendo spreadsheet.
I need a view-only mode that just shows the cells where they cannot be edited/modified. I need an admin-only mode where the entire spreadsheet control is functional.
For the view-only mode I tried the following, which does hide most of the stuff I don't want. But it requires more work to adjust heights and handle click events, at least. As it is when I do this various script errors are occurring when I click within the spreadsheet div:
$(document).ready(function () {
$('.k-spreadsheet-sheets-bar').hide();
$('.k-tabstrip-wrapper').hide();
$('.k-spreadsheet-action-bar').hide();
$('.k-spreadsheet-scroller').hide();
$('.k-spreadsheet-column-header').hide();
$('.k-spreadsheet-row-header').hide();
});
This is the code :
$("#chart").kendoChart({
title: {
text: "Distribution of roles per total number of articles(per selected levels)"
},
chartArea: {
width: 800,
heigth: 800,
stack: { type: "100%" }
},
legend: {
visible: true
},
seriesDefaults: {
type: "column"
},
series: [
{
name: "A",
// order: 1,
stack: "Chart",
data: chart_Profiling//[76067, 0, 0]
},
{
name: "B",
// order: 2,
stack: "Chart",
data: chart_Compulsory//[14183, 0, 0]
},
{
name: "C",
// order: 3,
stack: "Chart",
data: chart_Complement//[1197, 465606, 6567]
},
{
name: "HWW",
visibleInLegend: false,
stack: "Chart1",
data: chart_Profiling_1//[76067, 0, 0]
},
{
name: "HWW",
visibleInLegend: false,
stack: "Chart1",
data: chart_Compulsory_1 //[14183, 0, 0]
},
{
name: "HWW",
visibleInLegend: false,
stack: "Chart1",
data: chart_Complement_1//[1197, 465606, 6567]
},
{
name: "OHA E",
visibleInLegend: false,
stack: "Chart2",
data: chart_Profiling_All_SomeArticles//[76067, 0, 0]
},
{
name: "OHA E",
visibleInLegend: false,
stack: "Chart2",
data: chart_Compulsory_All_SomeArticles //[14183, 0, 0]
},
{
name: "OHA E",
visibleInLegend: false,
stack: "Chart2",
data: chart_Complement_All_SomeArticles//[1197, 465606, 6567]
},
],
seriesColors: ["rgb(214,186,114)", "rgb(197,200,203)", "rgb(170,115,80)"],
valueAxis: {
// majorUnit: (max7 / 10),
//max: (max7 + (max7 / 6)),
min: 0,
max: max7,
labels: {
template: "#= kendo.format('{0:N0}', value ) # "
},
line: {
visible: true
}
},
categoryAxis: {
categories: [Category1,Category2,Category3,Category4],
majorGridLines: {
visible: true
},
labels: {
template: labelTemplate,
rotation: -45
}
},
tooltip: {
visible: true,
template: "#= series.name #: #= value #"
}
,
pannable: {
// lock: "y",
// lock: "x"
},
zoomable: {
mousewheel: {
//lock: "y"
},
selection: {
// lock: "y"
}
}
});
}
I need to show the chart as shown in uploaded image.
There is my table:
public class Sound{ [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public Guid GUID { get; set; } [Display(Name = "Sound Type")] [Required] public SoundType SoundType { get; set; } [Display(Name = "Bandwidth, kHz")] public byte? Bandwidth { get; set; } [Display(Name= "Frequency, Hz")] public short? Frequency { get; set; } [Display(Name = "Duration, ms")] public short? Duration { get; set; } [Display(Name="Sound File")] public byte[] Content { get; set; } [Display(Name = "File Name")] public string FileName { get; set; } public Sound() { GUID = Guid.NewGuid(); }}
I just would like to show it in a grid and to be possible to upload files into the Content field and to store their names in the FileName field.
I've been trying to find out some examples of how to perform this, but almost all of them use separated steps to upload files into some directory on the server and to save the path to the file in the table then. I prefer to save the file attributes and its content as one step using Create or Update method of .
Is it possible to do it this way? Are there some examples?
Thank you.