Edit Template not show changes

Hello, 

i have created a small example where i want to change the displayed text in the Editform with a Button. 
Unfortunately the Text does not change. 
When open the Editform and click "Set New Name", the Value NewName is not show.
What am i doing wrong?
Blazor 18.4.0.42
Thanks for Help.
Frank

@page "/Testneu"
@using Syncfusion.Blazor.Grids
@using Syncfusion.Blazor.Calendars
@using Syncfusion.Blazor.DropDowns
@using Syncfusion.Blazor.Inputs
@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.Popups

<SfGrid DataSource="@Employees">
    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog">
        <Template>
            @{
                var Order = (context as EmployeeData);
            }
            <div class="form-row">
                <div class="form-group col-md-12">
                    <SfTextBox  @bind-Value="@cMatch" Placeholder='Name' FloatLabelType="FloatLabelType.Always"></SfTextBox>
                </div>
            </div>
        </Template>
        <FooterTemplate>
            <SfButton @onclick="@testchange">Set New Name</SfButton>
            @*<SfButton OnClick="@SaveForm" IsPrimary="true">Speichern</SfButton>
            <SfButton OnClick="@CloseEdit">Stornieren</SfButton>*@
        </FooterTemplate>
    </GridEditSettings>

    <GridColumns>
        <GridColumn Field=@nameof(EmployeeData.EmployeeID) HeaderText="Employee ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
        <GridColumn Field=@nameof(EmployeeData.FirstName) HeaderText="First Name" Width="130"></GridColumn>
        <GridColumn Field=@nameof(EmployeeData.Title) HeaderText="Title" Format="C2" Width="120"></GridColumn>
        <GridColumn Field=@nameof(EmployeeData.HireDate) HeaderText="Hire Date" Format="d" TextAlign="TextAlign.Right" Width="150" Type="ColumnType.Date"></GridColumn>
    </GridColumns>
</SfGrid>



@code{
    public List<EmployeeData> Employees { get; set; }

    public String cMatch="";
    
    protected override void OnInitialized()
    {
        Employees = Enumerable.Range(1, 9).Select(x => new EmployeeData()
        {
            EmployeeID = x,
            FirstName = (new string[] { "Nancy", "Andrew", "Janet", "Margaret", "Steven" })[new Random().Next(5)],
            LastName = (new string[] { "Davolio", "Fuller", "Leverling", "Peacock", "Buchanan" })[new Random().Next(5)],
            Title = (new string[] { "Sales Representative", "Vice President, Sales", "Sales Manager",
                                    "Inside Sales Coordinator" })[new Random().Next(4)],
            HireDate = DateTime.Now.AddDays(-x),
        }).ToList();
    }

    public class EmployeeData
    {
        public int? EmployeeID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Title { get; set; }
        public DateTime? HireDate { get; set; }
    }

    void testchange()
    {
        cMatch = "NewName";
    }
}



3 Replies 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team March 3, 2021 04:56 AM UTC

Hi Frank,  

Thanks for contacting Syncfusion support.  

Query: “Unfortunately the Text does not change.  When open the Editform and click "Set New Name", the Value NewName is not show” 

We have analyzed the reported query and we are able to reproduce the reported issue at our end also while preparing a sample using your code example. We suggest you to resolve the reported issue by calling the PreventRender(false) method of Grid. Because we have prevent the Grid from rendering to improve its performance. Hence on button click component inside DialogTemplate is not updated.  

Refer the below code example.  

<SfGrid @ref="Grid" DataSource="@Employees"> 
. .. .  
</SfGrid> 
 
@code{ 
    public List<EmployeeData> Employees { getset; } 
    SfGrid<EmployeeData> Grid { getset; } 
    void testchange() 
    { 
        Grid.PreventRender(false); 
        cMatch = "NewName"; 
    } 

Kindly download the sample from below which we have prepared using above solution.  


Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan  


Marked as answer

UN Unknown March 3, 2021 08:12 AM UTC

Thank you, very much. That was my Problem. 

Regards, Frank


VN Vignesh Natarajan Syncfusion Team March 3, 2021 09:38 AM UTC

Hi Frank,  

Thanks for the update.  

We are glad to hear that you have resolved your query using our solution.  

Kindly get back to us if you have further queries.  

Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon