Hi,
I am uploading an excel file and display it into spreadsheet. I want that when i upload an excel file, i fetch the records(say: ABC Class type) from posted file and validate using fluent validation. If there are any validation failure then it will be marked on the spreadsheet.
We have what SHOULD be a simple SSN entry field:
@Html.Kendo().MaskedTextBoxFor(model => model.SSN).Mask("000-00-0000").UnmaskOnPost(true).HtmlAttributes(new { @class = "form-control", style = "width:125px" })
The problem we're having is that if we leave some digits not filled in (i.e. - "555-33-2"), no error is thrown. Aren't the 0s supposed to be required digits?
Also, we have a regex attribute on the field in the model, for validations when NOT using the edit form (seeds, etc.). We're planning to disable it by adding the Html attribute @data_val = "false". Will that prevent the maskedtextbox from doing its work?
I'm trying to pass the selected rows in a grid to a controller action and I keep getting "kendo.grid.min.js:11 Uncaught TypeError: Cannot read property '1' of undefined" as an error.
I am not 100% sure what is undefined exactly. I have rows selected. If I break out the javascript to see that there are selected items I get them back just fine. The items that are selected have data for all 3 columns as well, so I am kind of lost on to what is undefined. My razor view code is below, thanks.
001.
@model SealRecommendationViewModel
002.
003.
@{
004.
ViewBag.Title = "Recommended Seal Models";
005.
}
006.
007.
@{ Html.EnableClientValidation(false); }
008.
009.
@using (Html.BeginForm("RecommendedSealModels", "SealRecommendation", FormMethod.Post, new { id = "recommendedSealModels" }))
010.
{
011.
<
div
class
=
"separator"
>
012.
<
h2
>Recommended Seal Models</
h2
>
013.
</
div
>
014.
<
div
>
015.
@(Html.Kendo().Grid(Model.SealRecommendationObjects)
016.
.Name("FilteredGrid")
017.
.Columns(columns =>
018.
{
019.
columns.Bound(s => s.SealTechnology).Title("Technology").Width(100);
020.
columns.Bound(s => s.CategoryCode).Title("Seal Model").Width(100);
021.
columns.Bound(s => s.Name).Title("Model Name").Width(100);
022.
})
023.
.Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
024.
//.Sortable()
025.
.DataSource(data => data.Server().Model(m => m.Id(p => p.ProductID)))
026.
.Events(events => events.Change("selectSealRecommendation"))
027.
)
028.
<
button
id
=
"btnBackBtn"
class
=
"buttonLeft"
type
=
"button"
value
=
"Back"
onclick
=
"location.href='@Url.Action("
Index", "SealRecommendation")'">Back</
button
>
029.
<
button
id
=
"btnSolution"
class
=
"buttonRight"
type
=
"submit"
value
=
"Next"
style
=
""
onclick
=
"submitSelectedSealModels();"
>Next</
button
>
030.
</
div
>
031.
}
032.
033.
<
script
type
=
"text/javascript"
>
034.
$(document).ready(function () {
035.
//Default functionalities
036.
var checkSeals = $('input:checkbox[id^="checkedSealModel"]:checked');
037.
$("#btnBackBtn").click(function () {
038.
window.location = '@Url.Action("Index", "SealRecommendation")';
039.
});
040.
if (checkSeals.length > 0) {
041.
$('#btnSolution').removeAttr("disabled");
042.
}
043.
else {
044.
$("#btnSolution").attr("disabled", "disabled");
045.
}
046.
//CheckBox click event
047.
$("input[id ^= 'checkedSealModel']")
048.
.on('click',
049.
function() {
050.
var checkedSeals = $('input:checkbox[id^="checkedSealModel"]:checked');
051.
if (checkedSeals.length > 0) {
052.
$('#btnSolution').removeAttr("disabled");
053.
}
054.
if (checkedSeals.length <
1
) {
055.
$('#btnSolution').attr("disabled", "disabled");
056.
}
057.
if ($('input:checkbox[id^="checkedSealModel"]').length == checkedSeals.length) {
058.
$("#checkAllSealModels").attr("checked", true);
059.
} else {
060.
$("#checkAllSealModels").attr("checked", false);
061.
}
062.
});
063.
//CheckAll checkbox click
064.
$("#checkAllSealModels")
065.
.on('click',
066.
function() {
067.
if ($("#checkAllSealModels").is(':checked') == true) {
068.
$('#btnSolution').removeAttr("disabled");
069.
$('input:checkbox[id^="checkedSealModel"]')
070.
.each(function() {
071.
$(this).attr('checked', true);
072.
});
073.
} else {
074.
$('#btnSolution').attr("disabled", "disabled");
075.
$('input:checkbox[id^="checkedSealModel"]')
076.
.each(function() {
077.
$(this).attr('checked', false);
078.
});
079.
}
080.
});
081.
});
082.
083.
function submitSelectedSealModels() {
084.
var entityGrid = $("#FilteredGrid").data("kendoGrid");
085.
var
selectedItems
=
entityGrid
.dataItem(entityGrid.select());
086.
087.
var
data
=
selectedItems
.toJSON();
088.
089.
var
customerForm
=
new
AjaxForm("recommendedSealModels");
090.
var
form
=
customerForm
.getForm(true);
091.
092.
AjaxServiceCall(form.action, form.method, data);
093.
}
094.
095.
function selectSealRecommendation(arg) {
096.
var selected = $.map(this.select(), function (item) {
097.
return $(item).text();
098.
});
099.
$('#btnSolution').prop("disabled", false).removeClass("disabled");
100.
}
101.
</script>
Hi,
I'm using client side grid dataSource filter: kendo.data.DataSource.filter with operator: "eq", but it returns case insensitive results.
For example:
<script>
var dataSource = new kendo.data.DataSource({
data: [
{ firstName: "joe", lastName: "doe" },
{ firstName: "Joe", lastName: "Doe" }
]
});
dataSource.filter( { field: "lastName", operator: "eq", value: "doe" });
var view = dataSource.view();
console.log(view.length);
</script>
returns 2.
Is there a way to make it case sensitive?
Thanks,
-Yuriy
Hello,
I've a kendo Grid in MVC that used ClientRowTemplate for coloring rows depending on the given data. Now we want to add details grid while keeping the current row template.
I've followed your example in http://demos.telerik.com/aspnet-mvc/grid/detailtemplate
and I was able to add the details grid while I've to remove ClientRowTemplate in order to have the grid rendered.
I need an example showing how to use the ClientRowTemplate in both main grid and the details one, in MVC.
Thanks You!
Hi, I'm trying to understand and replicate this demo: http://demos.telerik.com/aspnet-mvc/grid/localization
But since it is missing the source, I'm lost.
When are you going to update this document?
I'm trying to do the exact same thing on my application, I want the user to be able to select the language he/she prefers and see all widgets in that language.
I already have a DropDwonList for the languages and it is already working for the strings in my application, but I don't know how to change the telerik's widgets language.
Can somebody help me, please?
Thanks!
I am using the WYSIWYG Editor and trying to add a table. We have our own classes we use for the tables, so I am defining those classes at the top of the html and then adding my table in the html view. If I add a table with a class, after hitting update the editor adds the class "k-table" to the table. Is there a way to prevent this?
Thanks,
Jim
I'm using the "Filter Multi Checkboxes" and I am trying to hook it up to an existing MVC Controller Action which returns JSON data but in a different structure to what is expected.
Currently my code is
columns
.Bound(p => p.Customer)
.Filterable(ftb => ftb
.Multi(
true
)
.DataSource(ds => ds
.Read(r => r
.Action(
"Customers_Read"
,
"SalesLedger"
)
)
)
);
And this expects the action to return data in this structure
[{
"Customer"
:
"John"
},{
"Customer"
:
"Bob"
},{
"Customer"
:
"Mary"
}]
[
"John"
,
"Bob"
,
"Customer"
]
Is this possible?
Thanks ​
I would like to be able to hide the spreadsheet formula bar as well as the row and column headers. Is there any way to accomplish this?
Thanks,
Mark
I have a grid where a button on the form calls addRow(). So the row is in insert mode. How do I prevent the user from leaving the row until the values entered have been entered and are valid. Right now it is showing the hints when the user goes to another column without completing the cell but the user can completely leave the row and it remains empty of values.
Is there a way to call validate before calling grid.saveChanges()?