<div> @(Html.Kendo().TreeView() .Name("treeview") .DataTextField("DisplayValue") .DataSource(dataSource => dataSource .Read(read => read .Action("CategoryTree", "Category") ) ) ) </div>.Template("#: item.DisplayValue # " + @Html.ActionLink("Update", "Update", new { id = "newId" }).ToHtmlString().Replace("newId", "#: item.id #"))<div style="padding-top: 10px;"> @(Html.Kendo().TreeView() .Name("treeview") .DataTextField("DisplayValue") .DataSource(dataSource => dataSource .Read(read => read .Action("CategoryTree", "Category") ) ) .Template("#: item.DisplayValue # " + @Html.ActionLink("Update", "Update", new { id = "newId" }) .ToHtmlString().Replace("newId", "#: item.id #") + " | " + @Html.ActionLink("Deactivate", "Deactivate", new { id = "newId" }) .ToHtmlString().Replace("newId", "#: item.id #")) )</div>Hello,
I'm trying to set the width of a Kendo window I am using, and have so far been unable to get it to work. I've attached my code below, and I've bolded the three different places where I have tried setting the width (lines 7, 14, and 21) --so far, none of these individually or combined have created any effect on the width of the window.
Am I missing something here?
Thanks!
01.@(Html.Kendo().Window()02. .Name("preview")03. .Title("Preview")04. .Visible(false)05. .Modal(true)06. .Draggable(true)07. .Width(100)08.)09. 10.<script type="text/javascript">11. 12. function openPreview(storyID) {13. $("#preview").kendoWindow({14. width: 10015. });16. var dialog = $("#preview").data("kendoWindow");17. 18. dialog.refresh({19. data: { storyID: storyID },20. url: "@Url.Action("Preview", "Home")",21. width: 10022. });23. 24. dialog.center().open();25. }26.</script>Here is the existing thread link http://www.telerik.com/forums/how-to-change-command-buttons-dynamically-in-data-bound-event#KRtpAM_XoEeiI-UCwgwzsw
and here is my fiddle http://jsfiddle.net/valchev/Q69by/18/
I want to implement this using MVC using razor syntax . Please help
Thanks
I'm trying to use the NumericTextBox for values that are percentages, with three decimal points. How do I format it so it displays properly? I tried using .Decimals(3) but it still only displayed with two decimal numbers. For example, 34.567 displayed as 34.57... And it should also be a percentage, allowing only values up to 100.000
Here is what I have
@(Html.Kendo().NumericTextBox<decimal>() .Name("adminFee") // .Format("p") commented out since it didn;t appear to work .Min(0) .Max(100) .Decimals(3) .HtmlAttributes(new { style = "width: 100%", data_bind="value: AdminFee" }) )According to your docs:
http://docs.telerik.com/aspnet-mvc/helpers/combobox/overview#parameter-sending-to-server
There is a default event handler for the Data callback of the datasource. This event handler passes a reference to the combobox firing the event that can be resolved by running ".data("kendoComboBox")" against it.
However if I manually hookup the same function, I get an error when typing something into the combox, because the "selector" parameter isn't actually a combobox.
http://dojo.telerik.com/iPeca/3
It appears to be a bug?
I am trying to create a Data function that sends a reference to the combobox calling it as a parameter. And I cannot use strict ID selectors, because all my comboboxes have ID's that are generated dynamically at runtime.
So I'm doing something fairly simple. Using the Upload component... Here is my View code:
@{ ViewBag.Title = "Index";}<h2>Index</h2><div style="width: 45%"> <form method="post" id="csvForm" action='@Url.Action("Result", "Home")'> <div class="k-content"> @(Html.Kendo().Upload() .Name("files") .Multiple(false) ) <span class="k-invalid-msg" data-for="files"></span> <p></p> <div style="text-align: right"> @(Html.Kendo().Button() .Name("submit") .Content("Upload") .HtmlAttributes(new { type = "submit", @class = "k-button k-primary" }) ) </div> </div> <div id="status"></div> </form></div>
And my controller is also simple:
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Web;using System.Web.Mvc;using BankFTP.Attributes;namespace BankFTP.Controllers{ [MustBeAuthorized] public class HomeController : Controller { // GET: Home public ActionResult Index() { return View(); } public ActionResult Result(IEnumerable<HttpPostedFileBase> files) { if (files == null) { return RedirectToAction("Index"); } HttpPostedFileBase file = files.ToArray()[0]; string thisFile = file.FileName; FileInfo thisFileInfo = new FileInfo(thisFile); return View(); } }}
Nothing much to it really, and matches what the Basic Demo shows, except the IEnumerable<HttpPostedFileBase> parameter to the Action has a Count of 0, even though a file is chosen before pressing the Upload button. I know this should be fairly simple, and I've done it before, but I just don;t know what I'm missing here...
I have a grid with a datetime column that needs to be batch edited. The column has to be custom formatted that is different than the default format of the culture.
The code looks something like:
columns.Bound(product => product.DateField).Format("{0:dd.MM.yyyy}")
Also I have added the templates from Kendo src for Date/DateTime. @(Html.Kendo().DateTimePickerFor(m => m))
When I edit I always get the message "The field DateField must be a date".
I even tried to change the template with .ParseFormats(new string[] { "dd.MM.yyyy" }) but still I get the same message.
Can the datetimepicker be used in editing grid with custom format?
There are two parts to this question:
First, I am trying to add a column to the grid that looks normal, but will turn into a NumericTextBox when clicked into, and back to normal when clicked out. Originally, before I added .ClientTemplate, the cell looked normal and then would turn into a basic textbox when I click into it. After adding the .ClientTemplate, what shows up is a textbox initially (strange), that will SOMETIMES turn into a NumericTextBox when I click into it. There is no telling when this will happen or not. Additionally, if it does happen to turn into a NumericTextBox, when I click on the up or down arrows, the value will change for about .10 seconds and the switch back to the original value.
Second, I want an action to run that will redirect through my controller to update the model after I click off the NumericTextBox so that everything stays up to date. I do not want to have an "update" button because that is too inconvenient for the user, who will be trying to fill out the form as fast as possible.
Here is my Kendo Grid code (it should be noted that my onChangeNumeric function never fires):
@(Html.Kendo().Grid<FrictionGraphProgram.Models.FrictionMaterialModel.TempRawMaterial>().Name("RawPaperGrid").DataSource(dataSource => dataSource //Configure the Grid data source. .Ajax() //Specify that Ajax binding is used. .Read(read => read.Action("GetCurrentIngredients", "NewMaterial").Data("rawPaperGridFunctionRef")) .Events(events => events.Error("error_handler")) .Model(model => { model.Id (p => p.id ); model.Field(p => p.name).Editable(false); model.Field(p => p.percent).Editable(true); })).Columns(columns =>{ columns.Command(ingredient => ingredient .Custom("Delete") .Text(" ") .Click("deleteIngredient") .HtmlAttributes(new { title = "Delete Ingredient", style = "height:32px;width:32px;min-width:32px;min-height:32px;background-image:url('" + Url.Content("~/Images/if_Delete_1493279.png") + "');background-color:rgba(0, 0, 0, 0);border-color:rgba(0, 0, 0, 0);", functionRef = "DeleteRawPaperIngredient"})) .Width(54); columns.Bound(ingredient => ingredient.name).Title("Raw Ingredient"); columns.Bound(ingredient => ingredient.percent).Title("Percent %").Width(200).ClientTemplate(Html.Kendo().NumericTextBox<float>() .Name("ingredient_#=name#") .HtmlAttributes(new { value = "#=percent#" }) .Format("{0:n0}") .Min(0) .Max(100) .Step(1) .Decimals(0) .Events(ev => ev.Change("onChangeNumeric")) .ToClientTemplate().ToHtmlString());}).Editable(x => x.Mode(GridEditMode.InCell)).Sortable() // Enable sorting.Scrollable(scr => scr.Height(173)).HtmlAttributes(new{ type = "grid", functionRef = "DeleteRawPaperIngredient", gridRef = "#RawPaperGrid"}))
Hi,
I use ExpressiveAnnotations (https://github.com/jwaliszko/ExpressiveAnnotations) to use annotation-based conditional validation mechanisms in my forms.
(RequiredIf and AssertThat)
Now my question regarding Kendo MVC Grid Validation:
robert
