Data Annotations Validator in dialog box

How to Use DataAnnotationsValidator , ValidationSummary   in Popup Dialog box 

1 Reply 1 reply marked as answer

RK Revanth Krishnan Syncfusion Team June 11, 2021 12:21 PM UTC

Hi Devarajan, 
 
 
Greetings from Syncfusion support. 
 
 
We have validated your query “How to use data annotation validator and validation summary in the popup dialog box?” 
 
Your requirement can be achieved by rendering the Edit Forms with ‘DataAnnotationsValidator’ and ‘ValidationSummary’ in the content template of the Dialog. We have prepared a sample for your reference, 
 
Code Snippet: 
<SfDialog @ref="dialogObj" Height="85%" MinHeight="450px" Width="800px" ShowCloseIcon="true" IsModal="true" Visible="true"> 
    <DialogTemplates> 
        <Header>Dialog with DataAnnotationsValidator, ValidationSummary</Header> 
        <Content> 
            <EditForm Model="@employee" OnValidSubmit="HandleValidSubmit"> 
                <DataAnnotationsValidator /> 
                <ValidationSummary /> 
                <div class="container mx-2"> 
                    <div class="form-row"> 
                        <div class="form-group col-md-12"> 
                            <SfTextBox ID="username" @bind-Value="@employee.Name" Placeholder="Name" FloatLabelType="FloatLabelType.Auto" Width="50" /> 
                        </div> 
                    </div> 
                    . . . 
            </EditForm> 
        </Content> 
    </DialogTemplates> 
</SfDialog> 
 
 
Please check the above code snippet and the sample and let us know if it resolves the issue. 
 
Regards, 
Revanth 


Marked as answer
Loader.
Up arrow icon