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

https://stackoverflow.com/questions/73719432/how-to-conditionally-click-a-checkbox-in-telerik-grid-based-on-another-column-in


function onSave(e) 
    {

        //console.log(e.container.find("input[name=eTmfCompletenessComment]").val());

        //if (e.values.eTmfCompletenessComment.length > 3) 
        //{
        //    e.values.eTmfCompletenessActive == true;
        //}
        
        //if (e.container.find("input[name=eTmfCompletenessComment]").val().length > 3) 
        //{
        //    console.log(e.container.uid);
        //    //checkbox cell is in editmode
        //    e.container.find("input[name=eTmfCompletenessActive]").checked == true;
        //    //e.container.item.find("input[name=eTmfCompletenessActive]").checked == true;
            
        //}
       
        $(document).on("keyup", "#eTmfCompletenessComment", function () {
            function dirtyField(data, fieldName) {
                if (data.dirty && data.dirtyFields[fieldName]) {
                    return "<span class='k-dirty'></span>"
                }
                else {
                    return "";
                }
            }

             var commentcheck = $(this).val()
             console.log('$(this).val() =', $(this).val())

                var grid = $('#Grid').data("kendoGrid");
                var items = grid.items();
                if (commentcheck.length > 3) {
                    //var gc = $(this).parents(".k-")
                    $(this).parents(".k-master-row").find('input[type="checkbox"]').prop("checked", true);
                   //items.each(function () {
                        var dataItem = $(this).parents(".k-grid-cell").find('input[type="hidden"]');
                       set.dataItem.dirty = true;
                       dataItem.set(true);
                       dataItem.dirtyField.set(true, eTmfCompletenessActive)

                    //})
                 
                }
            })

        console.log("onSave");
    }

adam
Top achievements
Rank 1
 asked on 14 Sep 2022
0 answers
85 views

a model is returned to the form in which parameter "Raion" bool has a value of true or false.
How to make it so that CheckBox itself takes the required value?

@(Html.Kendo().CheckBox().Name("Raion").Label("Выезд на район"))

public class ServiceViewModel
    {
*****
        public bool Raion { set; get; }
****
    }
@model service.Models.ServiceViewModel

@(Html.Kendo().CheckBox().Name("Raion").Label("Выезд на район"))




Вадим
Top achievements
Rank 1
Iron
Iron
 asked on 11 Jan 2022
0 answers
227 views

I have a login form that have a boolean item (Remember Me) which is a bool value, The form shows the field as Input (Text Field) .. This is the form :

 


@(Html.Kendo().Form<SchoolCore.Models.ViewModel.LoginViewModel>()
                                                .Name("LoginForm")
                                                .Validatable(v =>
                                                {
                                                    v.ValidateOnBlur(true);
                                                    v.ValidationSummary(vs => vs.Enable(false));
                                                })
                                                .HtmlAttributes(new { action = "Login", method = "POST" })
                                                .Items(items =>
                                                {
                                                    items.Add()

                                                        .Field(f => f.Email)
                                                        .Label(l => l.Text("Email :"));

                                                    items.Add()
                                                        .Field(f => f.Password)
                                                        .Label(l => l.Text("Password :"));

                                                    items.Add()
                                                        .Field(f => f.RememberMe))
                                                        .Label(l => l.Text("Remember Me"));
                                                })
                                            )

What I miss?

Thanks in advanced

Abdulsalam Elsharif
Top achievements
Rank 2
Iron
Iron
 asked on 16 Sep 2021
0 answers
202 views

I have aKendo Grid, I have added custom validation on multiple columns. It's working as expected for all the columns, though it's not working for the columns of the type checkbox. It shows the error message even if the checkbox is unchecked.


columns.Bound(config => config.X).Title("X").HeaderHtmlAttributes(new { @class = "grid-headercustom" }).
ClientTemplate("#if(data.X == 1)" + "{#<span>Y</span>#}" + "else{#<span>N</span>#}#").
HtmlAttributes(new { @class = "grid-rowcustom" }).HtmlAttributes(new { style = "font-size:12px" }).Filterable(ftb => ftb.Enabled(false));


$.extend(true, kendo.ui.validator, {
    rules: {
        RateV: function (input, params) {
            if (input.is("[name='X']")) {
                var grid = $("#grid-pricefeedconfiguration").data("kendoGrid");
                var row = input.closest("tr");
                var dataItem = grid.dataItem(row);
                if (dataItem.X == true && dataItem.Y <= 0) {
                    input.attr("data-RateV-msg", "X must be greater than zero when the Y is ticked");
                    return false;
                }
            }
            
            return true;
            }
        },
        messages: {
            RateV: function (input) {
                // return the message text
                return input.attr("data-val-X");
            }
        }
    });
})(jQuery, kendo);

Vivek
Top achievements
Rank 1
Iron
 asked on 07 Aug 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?