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.
Unfortunately, activation email could not send to your email. Please try again.

Validation on InlineFormTemplate

Thread ID:

Created:

Updated:

Platform:

Replies:

131721 Jul 25,2017 05:31 AM Jul 26,2017 08:36 AM ASP.NET Core 1
loading
Tags: Grid
haryzad
Asked On July 25, 2017 05:31 AM

Hi Syncfusion etam support
How can i implement the validation to select some of the field for the mandatory field in InlineFormTemplate
My code as below (another code in attachment) and attachment also has been attach
<ej-grid id="GridSearchDiagnosis" allow-paging="true" allow-filtering="true">

<e-datamanager json="ViewBag.datasource"

update-url="/DiagnosisInformation/SaveDiagnosis"

insert-url="/DiagnosisInformation/SaveDiagnosis"

remove-url="/DiagnosisInformation/SaveDiagnosis"

adaptor="remoteSaveAdaptor" />

<e-edit-settings allow-adding="true" allow-editing="true" allow-deleting="true" edit-mode="@(EditMode.InlineFormTemplate)" inline-form-template-id="#templateSearchDiagnosis" />

<e-toolbar-settings show-toolbar="true" toolbar-items="@(new List<string>() {"edit","update","cancel"})">e-toolbar-settings>

<e-columns>

<e-column header-text="ICD 10" field="DiagnosisPartCode"

is-primary-key="false"

is-identity="false"

disable="true"

value="{{:DiagnosisPartCode}}"

width=20 />

<e-column header-text="Diagnosis Name" field="Text"

is-primary-key="true"

is-identity="true"

disable="true"

value="{{:Text}}"

width=70 />

e-columns>

ej-grid>


Thanks for the support


Attachment: InlineFormTemplate_Validation_699baee2.rar

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 26, 2017 08:36 AM

Hi Customer,  
 
We could see you are using a HTML.DropDownListFor. To apply validation to the MVC element, you have to give the ValidationSummary within the form as discussed in the following article. 
 
 
Normally, Grid will handle the validation for all the column if and only if they have been defined with Grid e-columns with the validation-rules. But, in your case, you have added some extra columns in the template form. So, we have handle them externally as discussed above. Refer to the following code example.  
 
<script type="text/template" id="templateSearchDiagnosis"> 
    <table> 
        <tr> 
            <td> 
                Diagnosis Name 
            </td> 
            <td> 
                <input id="Text" name="Text" value="{{: Text}}" disabled="disabled" class="e-field e-ejinputtext valid e-disable" 
                       style="width: 116px; height: 28px" /> 
            </td> 
            <td style="color:red"> 
                Natural History of Illness 
            </td> 
            <td> 
                @Html.ValidationSummary() 
                @Html.DropDownListFor(model => model.NaturalId, ViewBag.lNatural as SelectList, "Select", new { @value = "DiagnosisTypeDesc", htmlAttributes = new { @class = "form-control" } , style = "width: 100%;height: 14px;display: block;font-size: 11px;line-height: 1.428571429;color: #555;vertical-align: middle;background-color: #fff;border: 1px solid #ccc;" }) 
            </td> 
        </tr> 
    </table> 
</script> 
 
Please make a note that the NaturalID must be set with required annotation. Refer to the following code example. 
 
public class EditableOrder 
    { 
        [Required( ErrorMessage = "Selection is a MUST" )] 
        public string NaturalId 
        {                   
            get; 
            set; 
        } 
        . . . 
    } 
 
Regards,  
Seeni Sakthi Kumar S. 


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.

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.

;