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. Image for the cookie policy date

When I insert an element by the DataManager the Checkbox is always with the value ON

Hi There.

I'm using the Grid control, and I face this issue, I use a DataManager to do the CRUD functionality, one of the columns is  a Checkbox. when the DataManager receive the call for insert the Checkbox is always sending on.
And the other issue is that the Validation rules are not working.

Thanks in advance.


[WebMethod, ScriptMethod(UseHttpGet = false)]
    public static void NotesInsert(Dictionary<string, object> value, string action)
    {
          value["Completed"] // Always with the value ON


     }



                            <ej:DataManager runat="server"  ID="gvNotesData" URL="EmployeeUpdateUAT_N.aspx/NotesGet" Adaptor="WebMethodAdaptor"  InsertURL="EmployeeUpdateUAT_N.aspx/NotesInsert" >

                            <ej:Grid ID="gvEmployeeNote" runat="server" AllowPaging="true" AllowTextWrap="true" DataManagerID="gvNotesData"  >
                                <EditSettings AllowEditing="false" AllowAdding="true" AllowDeleting="false"></EditSettings>
                                <ToolbarSettings ShowToolbar="true" ToolbarItems="add,update,cancel"></ToolbarSettings>
                                <TextWrapSettings WrapMode="Content" />
                                <Columns>
                                    <ej:Column Field="Notes" Width="40%" AllowTextWrap="true" HeaderTextAlign="center"   EditType="StringEdit">
                                        <ValidationRule>
                                            <ej:KeyValue Key="required" Value="true"  />
                                            <ej:KeyValue Key="minlength" Value="true" />
                                        </ValidationRule>
                                    </ej:Column>
                                    <ej:Column Field="LastUpdate" HeaderText="Last Update" HeaderTextAlign="center"  AllowEditing="false" Format="{0:dd/MM/yyyy HH:mm}" Width="12em" TextAlign="Right"   />
                                    <ej:Column Field="CreatedBy" AllowEditing="false"  Width="12em" HeaderTextAlign="center"  /> 
                                    <ej:Column Field="NoteCategoryId" EditType="DropdownEdit" HeaderText="Category" HeaderTextAlign="center" 
                                        ForeignKeyField="NoteCategoryId" 
                                        ForeignKeyValue="NoteCategoryName" TextAlign="Left" >
                                        <ValidationRule>
                                            <ej:KeyValue Key="required" Value="true"  />
                                        </ValidationRule>
                                        </ej:Column>
                                    <ej:Column Field="DueDate" AllowEditing="false" HeaderText="Due date" HeaderTextAlign="center"  />
                                    <ej:Column Field="Completed" EditType="BooleanEdit" TextAlign="Center"  AllowEditing="false" HeaderTextAlign="center"  />
                                    <%--  <ej:Column Field="NoteCategoryName" />--%>
                                    
                                </Columns>
                            </ej:Grid>

1 Reply

VN Vignesh Natarajan Syncfusion Team February 7, 2019 09:27 AM UTC

 Hi Nestor 
 
Thanks for contacting Syncfusion Support. 
 
Query#1:- I use a DataManager to do the CRUD functionality, one of the columns is  a Checkbox. when the DataManager receive the call for insert the Checkbox is always sending on. 
 
From your query, we understand that you are facing issue while inserting the a record with checkbox value. We have checked your reported problem as like your code example but we are unable to reproduce your problem at our end. Please refer to the sample Link 
 
 
Refer to the screenshot:- 
 
 
 
 
 
Note: reported issue may occur when primary key is not defined for any of the available column. So kindly ensure to define the IsPrimaryKey property to available column whose value is unique  
 
Query#2:- And the other issue is that the Validation rules are not working. 
 
We have checked your query and the reported problem occurs when we doesn’t refer the validation script files that are necessary to perform validation. So we suggest you to refer “jquery.validate.min.js” in site.master file. 
 
Please refer to the below documentation Link 
 
 
You can get the script file from your build installed location and refer to the below location.  
              {programfilesfolder}\Syncfusion\Essential Studio\{Version}\JavaScript\assets \external \.... 
 
                Eg: C:\Program Files (x86)\Syncfusion\Essential Studio\16.2.0.42\ JavaScript\assets\external \  …. Get the required script files and load into your project.   
 
Refer to the screenshot:- 
 
 
 
After following the above solution still facing the issue. Please share us the following details. 
 
  1. Complete Grid code example(Server side code example ).
  2. Screenshot of the Network Tab/ Video Demo to replicate the issue.
  3. Ensure that validation files are referred in your project. Share your Site.Master.cs file.
 
Requested details will help us to validate the reported issue at our end. 
 
Regards, 
Vignesh Natarajan 
 


Loader.
Up arrow icon