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
I have kendo editor inside of modal in a tabstrip window.
My Kendo editor is defined as below -
@(Html.Kendo().Editor()
.Name("instEditor")
.Tag("div")
.Encode(false)
.Tools(tools => tools
.Clear()
.Bold()
.Italic()
.Underline()
.Strikethrough()
.JustifyCenter().JustifyFull().JustifyLeft().JustifyRight()
.CreateLink().Unlink().TableEditing().FontColor().BackColor())
.Value(Model.IContent)
)
I am getting the text in Kendo editor form database.
Whenever I run the application and Kendo editor renders, editor is loaded properly. When I click inside the editor, the toolbar pops up as expected.
But as soon as I select a text in the editor or basically whenever I mousedown in the editor second time after initially entering into the editor, the toolbar disappears. And it does not appear back until I click outside of the editor and then click back inside the editor.
How can I solve this issue?
Thanks!
Hi,
Our development team updated the Telerik Kendo MVC components to 2017 R2 Version. After this update the all MultiSelect always shown the loading icon.
How can I hide this gif icon from all MultiSelect?
I am trying to create a page with grid format and I used kendo controller also installed kendo in my system but its showing me this error. I have used code first entity framework for the code.
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult companys_Create([DataSourceRequest]DataSourceRequest request, company company)
{
if (ModelState.IsValid)
{
var entity = new company
{
companyname = company.companyname
};
db.companys.Add(entity);
db.SaveChanges();
company.companyid = entity.companyid;
}
return Json(new[] { company }.ToDataSourceResult(request, ModelState));
}
I am getting error at httpverbs. Can anyone give a solution.
Assume I have created Testcontroller and added a Testcombobox control in views(Eg. TestView.cshtml). I implements the function and return data is working fine. Now I added existing Testcombobox control in different Controller (eg. Test1View1.cshtml and Test1Controller) is not loading data and it getting error like uncaught TypeError: Cannot read property 'slice' of undefined.
Eg ComboControl.
@(Html.Kendo().ComboBoxFor(m => m)
.Name("cbtest")
.Placeholder("--Select--")
.DataSource(source => source
.Custom()
.ServerFiltering(false).Transport(transport => transport
.Read(read =>
{
read.Action("TestAction", "Test");
}))
.Schema(schema => schema.Data("Data")
.Total("Total")
.Errors("errors")))
.MinLength(3)
.AutoBind(true)
.Filter(FilterType.Contains)
.DataValueField("sTestEntCode")
.DataTextField("sTestText")
Is there anything missing code or reference?
Note: Using Area Controller and the same control added another area controller.
Hi All,
In my date picker date coming as invalid. i mean moth coming as 48. why? Please see attached screen shot