Telerik Forums
UI for ASP.NET MVC Forum
0 answers
113 views

I changed the value of checkboxes of a column filter, because I use a custom template in the column. I need to change the operator from 'equal' to 'contains', but if I change the grid won't show the filters.

Operator changed to "contains":

Without changed the operator:

I use this method to change operator (this method subscribed to grid's Filter event):

function gridFilter(e) {
    if (e.filter) {
        e.filter.filters.forEach(function (f) {
            f.operator = "contains";
        })
    }
}

What did I wrong? Why does not work the multifilter with "contains" operator?

 

 

SCH
Top achievements
Rank 1
 asked on 03 Mar 2022
5 answers
128 views
Good morning,

we would need to implement the following excel-like functions on a Telerik spreadsheet:
 - Average/Sum/Count of the selected cells. (sum-avarage-count.jpg)
 - copy-paste in the cells below with respect to a cell selected by double clicking in the lower-right corner. (copy-paste double click 1/2.jpg)

Are there any options in Telerik to replicate these features?

Kind regards,
Eyup
Telerik team
 answered on 03 Mar 2022
1 answer
141 views

I have a grid that contains a child detail spreadsheet.  I am trying to duplicate some code I used from another Kendo Spreadsheet, but each spreadsheet and Export button needs to have a unique id.  In the form I am using to export the Excel for the spreadsheet, I am using a Kendo Button to allow addition of the unique id (TplNum) from the parent grid.  For some reason, the template is not valid when I add the Kendo Button.  Any ideas?

I was going to use the Click event to determine the TplNum based on location of the button or the button id field in the Javascript callback, but thought that was giving me problems.  Currently, I gave the buttons a class, "export_excel" and I'm trying to create a jQuery onClick function in my document.load, which is invoked based on class, rather than id.

    $(document).ready(function () {
        $(".export_excel").click(function (e) {

        }

   }

<script id="campaign_template" type="text/kendo-tmpl">

        @using (Html.BeginForm("SpreadsheetDownload", "Campaign", FormMethod.Post, new { @class = "form-horizontal", role = "form", id = "spreadsheet_form_#=TplNum#" }))
        {
            @Html.Hidden("data", null, htmlAttributes: new { name= "data", id = "download-data_#=TplNum#" });
            @Html.Hidden("extension", null, htmlAttributes: new { name = "extension", id = "download-extension_#=TplNum#" });
            @(Html.Kendo().Button()
                    .Name("export_excel")
                    .HtmlAttributes(new { type = "button", id = "export_excel_#=TplNum#", @class = "export_excel" })
                    .Content("Export to Excel"));
                    //.Events(e => e.Click("ExportExcel")));
        }
Eyup
Telerik team
 answered on 28 Feb 2022
1 answer
200 views

Good morning,

in a Telerik spreadsheet, is there a property to set the number of maximum decimal places of the value of each single cell? what default value has this property set?
What scope does it have? Is it set for each single cell or on the entire spreadsheet?

For example we have a cell that has value with 11 decimal places, how can we modify it (increase or decrease it)?

Kind regards,

Eyup
Telerik team
 answered on 25 Feb 2022
1 answer
180 views

Good morning,

is there the possibility on a Telerik spreadsheet to increase the maximum limit of digits (currently 15 digits) for cells with format number?

 

Kind regards,

Eyup
Telerik team
 answered on 25 Feb 2022
0 answers
871 views

I have a switch control, placed inside of a tab control, in a client detail template, as part of a grid.

I need to bind the switch checked property, to a value stored in the grids dataset, which is a Boolean. However, the code causes the error:-

Preprocessor directives must appear as the first non-whitespace character on a line

The code is:-

<script id="subsubdetailsTemplate" type="text/kendo-tmpl">

@(Html.Kendo().TabStrip().Name("Tabstrip_#=ReportID#")
         .Items(i =>
         {

         i.Add().Text("Report Details").Selected(true).Content(@<text>


    <div>

    <p> #=HideOnCatalogue#</p>

    Hide from Catalogue?:
     @(Html.Kendo().Switch()
                    .Name("switch_#=ReportID#")
                    .Events(e => e.Change("function(e){ switchChange(e, '#=ReportID#')}"))
        .Checked(#=HideOnCatalogue#)
        .Messages(c => c.Checked("YES").Unchecked("NO"))
        .ToClientTemplate()
    )


    </div>
    </text>);

       



         }).ToClientTemplate())


</script>

How can I bind the value to the switch?  I can display the value in a <p> tag without a problem, as well as passing the report ID to the function called when the switch is clicked.

Thanks

AP
Top achievements
Rank 1
Iron
Iron
Veteran
 asked on 24 Feb 2022
0 answers
224 views

Each Filter only loads Once!     After a full page refresh/reload, and a page search and data load to the Grid/dataSource

- then the Grid Filters (smart drop downs) will load after clicking the first time (only) based on grid data values.

However, when the query is changed to load more or less data in the grid with a new "dataSource.read()"

- Then the Filters are never cleared or reloaded, so are no longer "Smart" based on the (new) data in the grid?

Have tried everything online and in forums to clear the filters, nothing works. 

The datasource "filter" method is read (get) only - why is there no "flush" or "clear" or reload method for the filter(s)?

Is there a list indicating whether that filter was already activated (container created) or not, that you could just clear after removing the containers!?   (last 4 lines below)

Scott
Top achievements
Rank 1
 updated question on 23 Feb 2022
1 answer
243 views

I've read the examples, and I've followed along as best as I can, but I'm still having an issue getting a simple dropdown into my grid (ASP.NET MVC)

I have a model called Supplier, and a model called VehicleType

    

public class Supplier { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] [Display(Name = "Id")] public int SupplierId { get; set; } [Display(Name = "Supplier Number")] public int SupplierNumber { get; set; } [Display(Name = "Name")] public string SupplierName { get; set; } [Display(Name = "Vehicle Type Id")] public int VehicleTypeId { get; set; } [Display(Name = "Status Id")] public int StatusId { get; set; }

// I added this [NotMapped] [UIHint("VehicleType")] public VehicleType VehicleType { get; set; } } public class VehicleType { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int VehicleTypeId { get; set; } public string VehicleTypeName { get; set; } }

My Grid is as follows:

@(Html.Kendo().Grid<MyProject.Models.Schedule.Supplier>
    ()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Select().Width(50);
        columns.Bound(p => p.SupplierNumber).Filterable(ftb => ftb.Multi(true));
        columns.Bound(p => p.SupplierName).Groupable(true).Filterable(ftb => ftb.Multi(true));
        //columns.Bound(p => p.VehicleTypeId).Filterable(ftb => ftb.Multi(true));
        columns.Bound(p => p.VehicleType).ClientTemplate("#=VehicleType.VehicleTypeName#").Sortable(false);

    })
    .Pageable()
    .Sortable()
    .ToolBar(toolBar =>
    {
        toolBar.Create();
        toolBar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .PersistSelection()
    .Scrollable()
    .Groupable()
    .Filterable()
    .HtmlAttributes(new { style = "height:600px;" })
    .Resizable(r => r.Columns(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(p => p.SupplierId))
        .PageSize(100)
        .Events(events => events.Error("error_handler"))
        .Read(read => read.Action("GetSuppliers", "Schedule"))
        .Update(update => update.Action("EditSupplier", "Schedule"))
        .Create(create => create.Action("CreateSupplier", "Schedule"))
    )
    )

My controller looks like this:

        // View for the page
        public ActionResult Supplier()
        {
            ViewData["vehicleTypes"] = new Models.MyContext()
                .vehicleTypes
                .Select(v => new VehicleType
                {
                    VehicleTypeId = v.VehicleTypeId,
                    VehicleTypeName = v.VehicleTypeName
                })
                .OrderBy(v => v.VehicleTypeName);

            return View();
        }

        // Using this to get the data for the grid
        public ActionResult GetSuppliers([DataSourceRequest] DataSourceRequest request)
        {
            List<Models.Schedule.Supplier> result = MyLogic.suppliers();
            return Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }

And finally I created an EditorTemplate called VehicleType.cshtml

@(Html.Kendo().DropDownList()
        .Name("VehicleType") 
        .DataValueField("VehicleTypeId")
        .DataTextField("VehicleTypeName")
        .BindTo((System.Collections.IEnumerable)ViewData["vehicleTypes"])
    )

When I try to view the grid I get this error:

The entity or complex type 'MyProject.Models.VehicleType' cannot be constructed in a LINQ to Entities query.

After some googling, I changed my ViewData lookup in my controller to this:

Which displays my grid (empty though there should be 31 rows) and the console has the following error:

Uncaught TypeError: Cannot read properties of null (reading 'VehicleTypeName')
    at eval (eval at compile (kendo.all.js:241:30), <anonymous>:3:3673)
    at init._rowsHtml (kendo.all.js:74650:37)
    at init._renderContent (kendo.all.js:75513:34)
    at init.refresh (kendo.all.js:75329:22)
    at init.d (jquery.min.js:2:3873)
    at init.trigger (kendo.all.js:171:37)
    at init._process (kendo.all.js:8341:22)
    at init.success (kendo.all.js:8037:22)
    at success (kendo.all.js:7928:42)
    at Object.n.success (kendo.all.js:6762:25)

Can someone point me in the right direction here? 

Without trying to add the dropdown, it all works as expected, but I'd rather not have to type in the id values when editing/creating a row

I've been bashing my head against the wall for it for a couple of hours now, so any kind of help would be greatly appreciated.

Thanks

 

Anton Mironov
Telerik team
 answered on 22 Feb 2022
2 answers
137 views

Hi,

in our company we are testing migration Migration Telerik ASP.NET MVC from 2016.3.1028.545 to 2022.1.119.545.

Our app now is working with .NET 4.8.

We have upgrade all microsoft asp.net mvc references to make compatibles with new teleric dll.

We have migrated dll through upgrade wizard (Api Analyzer didnt work, when we have select all selection it began to run and swicht off)

We have changed all scripts, styles manually.

We have changed file kendo-ui.d.ts for kendo.all.d.ts manually

then when we have compiled app we get an error :

Error	TS2339	(TS) Property '_decorateMessageContainer' does not exist on type 'Validator'.	

It seems that in kendo.all.d.ts , in Validator doesnt exists property '_decorateMessageContainer' anymore, so our function doesn't work:


function addValidationEvent() {
    var oDecorateMessageContainer = kendo.ui.Validator.fn._decorateMessageContainer;
    kendo.ui.Validator.fn._decorateMessageContainer = function () {
        $('[name="' + arguments[1] + '"]').trigger("validation-error");
        return oDecorateMessageContainer.apply(this, arguments);
    };

    var oValidateInput = kendo.ui.Validator.fn.validateInput;
    kendo.ui.Validator.fn.validateInput = function () {
        arguments[0].trigger("validation-check");

        return oValidateInput.apply(this, arguments);
    };
}

Id like to know :

1º) Can we upgrade directly from 2016 Telerik version to 2022 or we have to upgrade first to another version.

2º) Is version 2022 the better version for our app or is better another earlier one ?

3º) How can i fix the error explained below?

 

Thanks in advance.

Mariano
Top achievements
Rank 1
Iron
 answered on 22 Feb 2022
3 answers
158 views

 again >>
I can't restore the kendo on mu new laptop,

I mapped my project and it required to restore the kendo , but it appear this message !
any help ? 

 

 
Wafaa
Top achievements
Rank 1
Iron
 answered on 20 Feb 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?