We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CheckBoxFor control does not change the field data of form

Thread ID:

Created:

Updated:

Platform:

Replies:

147056 Aug 30,2019 09:55 AM UTC Sep 9,2019 07:29 AM UTC ASP.NET MVC - EJ 2 5
loading
Tags: CheckBox
Huy Ly
Asked On August 30, 2019 10:00 AM UTC

Hi Team,
I use Grid control with Dialog Template mode. My template look like this:

   


The IsDiKhoiDiaPhuong and IsDiKhoiDiaPhuong are both Nullable Bool type.

When i submit the form from dialog to server, the value of these CheckBoxFor are not change. It keep the "false" value instead.







Saranya Dhayalan [Syncfusion]
Replied On September 2, 2019 09:25 AM UTC

Hi Huy Ly, 

Thank you for contacting Syncfusion support. 

We have checked your reported issue and we would like to let you know that our EJ2 CheckBox doesn’t support nullable bool type. It supports only the Boolean value and accepts either true or false value. For more details regarding this, please refer the below link. 


Could you please check the above link and get back to us with more information like controller side code (model value binding for checkbox), if you still getting the issue or need any further assistance on this. 

Regards, 
Saranya 
 


Huy Ly
Replied On September 6, 2019 03:23 AM UTC

I changed the Nullable bool type to Non-Nullable bool type, but with no luck. The value of these property still remain "false" when i submit to server.
I am using Syncfusion.EJ2, Version=17.2500.0.46






Attachment: CheckboxFor_f3bb7ead.rar

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On September 6, 2019 11:18 AM UTC

Hi Huy, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported issue and we suggest you to specify the actionBegin event for grid component. You must specify the name attribute for the Checkbox component. Please find the below code snippet, 
 
_EditPartial.cshtml 
<div class="form-row"> 
        <div class="col-md-4 form-group"> 
            @Html.EJS().CheckBoxFor(model => model.IsGiaoDucTaiDiaPhuong).Label("Giáo dục tại địa phương").Name("IsGiaoDucTaiDiaPhuong").Render() 
        </div> 
        <div class="col-md-4 form-group"> 
            @Html.EJS().CheckBoxFor(model => model.IsDuaVaoCoSoGiaoDuc).Label("Đưa vào cơ sở giáo dục").Name("IsDuaVaoCoSoGiaoDuc").Render() 
        </div> 
        <div class="col-md-4 form-group"> 
            @Html.EJS().CheckBoxFor(model => model.IsDangBiTruyTo).Label("Đang bị truy tố").Name("IsDangBiTruyTo").Render() 
        </div> 
    </div> 
    <div class="form-row"> 
        <div class="col-md-4 form-group"> 
            @Html.EJS().CheckBoxFor(model => model.IsAnCoHieuLuc).Label("Án có hiệu lực").Name("IsAnCoHieuLuc").Render() 
        </div> 
        <div class="col-md-4 form-group"> 
            @Html.EJS().CheckBoxFor(model => model.IsXoaXuLyHanhChinh).Label("Xóa xử lý hành chính").Name("IsXoaXuLyHanhChinh").Render() 
        </div> 
    </div> 
 
Index.cshtml 
@Html.EJS().Grid("ViPhamTaiPhamGrid").GridLines(Syncfusion.EJ2.Grids.GridLine.Both).DataSource(dataManager => 
{ 
    dataManager.Json(ViewBag.listViPhamTaiPham) 
.InsertUrl(ViewBag.InsertUrl).UpdateUrl(ViewBag.UpdateUrl).RemoveUrl(ViewBag.DeleteUrl).Adaptor("RemoteSaveAdaptor"); 
}).Query("new ej.data.Query().addParams('NguoiChapHanhID', 1)").AllowMultiSorting().AllowSorting().AllowFiltering().ActionComplete("ViPhamTaiPhamActionComplete").Columns(col => 
{ 
    col.Field("ID").HeaderText("ID").IsIdentity(true).IsPrimaryKey(true).Visible(false).Add(); 
    col.Field("NoiDung").HeaderText("Nội dung").Add(); 
 
 
}).ActionBegin("begin").AllowPaging().PageSettings(page => { page.PageCount(3); page.PageSize(5); }).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog).Template("#NguoiChapHanhChiTietDialogTemplate"); edit.ShowDeleteConfirmDialog(true); }).Toolbar(new List<string> 
    () { "Add", "Edit", "Delete", "Update", "Cancel", "Search" }).FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Excel); }).Locale("vi").Render() 
 
 
function begin(e) { 
        if (e.requestType == "save") { 
            e.data['IsGiaoDucTaiDiaPhuong'] = e.form.querySelector("#IsGiaoDucTaiDiaPhuong").ej2_instances[0].checked; 
            e.data['IsDuaVaoCoSoGiaoDuc'] = e.form.querySelector("#IsDuaVaoCoSoGiaoDuc").ej2_instances[0].checked; 
            e.data['IsDangBiTruyTo'] = e.form.querySelector("#IsDangBiTruyTo").ej2_instances[0].checked; 
            e.data['IsAnCoHieuLuc'] = e.form.querySelector("#IsAnCoHieuLuc").ej2_instances[0].checked; 
            e.data['IsXoaXuLyHanhChinh'] = e.form.querySelector("#IsXoaXuLyHanhChinh").ej2_instances[0].checked; 
        } 
    } 
 
For your convenience we have prepared a sample. Please find the sample in below link,  
 
Could you please check the above details and get back to us if you need any further assistance on this? 
 
Regards, 
Vinoth Kumar S 


Huy Ly
Replied On September 7, 2019 01:45 PM UTC

It works as expected. Thank you so much for your support. Have a nice day Team!

Ashokkumar Balasubramanian [Syncfusion]
Replied On September 9, 2019 07:29 AM UTC

Hi Huy,  
 
We are glad to hear that the problem has been resolved. Please let us know, if you need any further assistance. 
 
Regards, 
Ashokkumar B. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon