CheckBoxFor value not passed to controller via model binder

Hello,

I have multiple CheckBoxFor controls inside a Tab control wrapped in a form. Neither of these CheckBoxes are passing their value back to controller on form submit. Standard Html.CheckBoxFor is working great and also, other Html controls. Hierarchy in view is like this:

FORM
     TAB control
          Tab 1
               CheckBoxFor
          Tab2
            ... 

Can you please help me with this, because I'm struggling with this, for a couple of days.


Thanks in advance,
Ivan

3 Replies

PK Prem Kumar Madhan Raj Syncfusion Team January 2, 2018 12:36 PM UTC

Hi Ivan,   
  
Thanks for contacting Syncfusion Support.   
  
We have looked into your query “having CheckBoxFor controls with tab control wrapped in a form, checkbox not passing their values back to controller on form submit” and tried with a sample in our end. Unfortunately, we cannot reproduce the reported issue. We have tried a sample with the same hierarchy as suggested at your end and attached in the below link. Please check it.   
  


  
In the above sample, once the form is submitted, the below shown function will hit and the values of the CheckboxFor controls can be obtained from the model values.   
  
[Butcontroller section]   
[HttpPost]   
        public ActionResult ButtonFeatures(CheckboxModel model)   
        {   
            return View(model);   
        }   
    
  
If the issue persists, please revert with more information along with an issue reproducing sample so that we can provide an exact solution for your requirement.   
  
Regards,   
Prem Kumar. M


PR Programming January 17, 2018 07:06 PM UTC

I am noticing this problem as well. I'm also noticing that multiple checkboxes are not being styled the same.
I am using version: Syncfusion.EJ.Mvc, Version=15.4500.0.17

<div class="form-group">
                                <label class="control-label col-md-3">Send Redemption Notice</label>
                                <div class="col-md-9">
                                    @Html.EJ().CheckBoxFor(model => model.SendReferrerConfirmationEmail)
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">Replenish Expired Offers </label>
                                <div class="col-md-9">
                                    @Html.EJ().CheckBoxFor(model => model.ReplenishExpired)
                                </div>
                            </div>


PK Prem Kumar Madhan Raj Syncfusion Team January 18, 2018 11:39 AM UTC

Hi Ivan, 
 
Thanks for contacting Syncfusion support. 
 
We have looked into your query that “multiple checkboxes are not being styled the same” and unable to reproduce the reported issue at our end. We suspect that the issue may be caused because of assigning an invalid model value to the CheckBoxFor control from your end. So, please ensure that only a valid value is passed as model value to the CheckBoxFor control. 
 
For your convenience, we have created a simple sample based on your requirement (multiple checkbox for controls) and attached the sample in the below link. 
 
 
 
If the issue persists, then revert to us with an issue reproducing sample such that we can provide the exact solution for your requirement. 
 
Regards, 
 
Prem Kumar. M

Loader.
Up arrow icon