Can you use a seperate component as the Template for EditMode.Dialog

Folks

I'm wondering you can have the <Template></Template> component of a Grid as a separate component?

The context is simply to have easier to manage code i.e. not have everything in a single file.

Thanks


1 Reply

RS Renjith Singh Rajendran Syncfusion Team August 9, 2021 11:37 AM UTC

Hi Tommy, 

Greetings from Syncfusion support. 

Yes, we can define the contents of edit dialog as a separate component. We have prepared a sample to contain the contents of Dialog template editing as a separate component. Please download and refer the sample from the link below, 
 
Please refer the codes below, 

 
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Dialog"> 
    <Template Context="innertemplate"> 
        @{ 
            var contextval = (innertemplate as Order); 
        } 
        <FirstEditDialog Contextvalue="contextval"></FirstEditDialog> 
    </Template> 
</GridEditSettings> 

[FirstEditDialog.razor]@using Syncfusion.Blazor.Inputs@using ServerApp.Data  <SfTextBox ID="CustomerName" @bind-Value=@Contextvalue.CustomerName ...></SfTextBox> @code {        [Parameter]        public Order Contextvalue{ getset; }}

Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon