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
close icon

The Name Model does not exists in current context @Model

Dear Sir

Grid external edit template not working.

Version
  
   <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.3.11/material.css" rel="stylesheet" />
    <script src="https://cdn.syncfusion.com/ej2/17.3.11/dist/ej2.min.js"></script>
    <script src="https://cdn.syncfusion.com/ej2/17.3.11/dist/ejs.interop.min.js"></script>

@using Syncfusion.EJ2.Blazor.Grids
@using Syncfusion.EJ2.Blazor.Calendars
@using Syncfusion.EJ2.Blazor.DropDowns
@using Syncfusion.EJ2.Blazor.Inputs


<h3>CustomerList</h3>

<div class="col-lg-12 control-section">
    <div class="content-wrapper">
        <div class="row">
            <EjsGrid TValue="CustomerDto" DataSource="@customers" ModelType="@Model" AllowPaging="true" Toolbar="@(new List<string>() { "Add","Search"})">
                <GridEditSettings  AllowAdding="true" AllowEditing="true" AllowDeleting="true" ShowDeleteConfirmDialog="true" Mode="EditMode.Dialog">
                    <Template>
                        @{
                            var CustomerDetail = (context as CustomerDto);
                            <div>
                                <div class="form-row">
                                    <div class="form-group col-md-6">
                                        <label class="e-float-text e-label-top">Customer ID</label>
                                        <EjsTextBox ID="Id" Value="@(CustomerDetail.Id.ToString())" Enabled="false"></EjsTextBox>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label class="e-float-text e-label-top">Customer Name</label>
                                        <EjsAutoComplete ID="Name" FloatLabelType="FloatLabelType.Auto" Value="@(CustomerDetail.Name)" TValue="string" DataSource="@customers">
                                            <AutoCompleteFieldSettings Value="Name"></AutoCompleteFieldSettings>
                                        </EjsAutoComplete>
                                    </div>
                                </div>
                                <div class="form-row">
                                    <div class="form-group col-md-6">
                                        <label class="e-float-text e-label-top">Phone Number</label>
                                        <EjsNumericTextBox ID="PhoneNumber" Value="@(CustomerDetail.PhoneNumber)" TValue="string"></EjsNumericTextBox>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label class="e-float-text e-label-top">Address</label>
                                        <EjsNumericTextBox ID="Address" Value="@(CustomerDetail.Address)"></EjsNumericTextBox>
                                    </div>
                                </div>
                                <div class="form-row">
                                    <div class="form-group col-md-6">
                                        <label class="e-float-text e-label-top">City</label>
                                        <EjsNumericTextBox ID="City" Value="@(CustomerDetail.City)"></EjsNumericTextBox>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label class="e-float-text e-label-top">Email</label>
                                        <EjsNumericTextBox ID="Email" Value="@(CustomerDetail.Email)"></EjsNumericTextBox>
                                    </div>
                                </div>
                                <div class="form-row">
                                    <div class="form-group col-md-12">
                                        <label class="e-float-text e-label-top">Gender</label>
                                        <EjsTextBox ID="Gender" Value="@(CustomerDetail.Gender.ToString())"></EjsTextBox>
                                    </div>
                                </div>
                            </div>
                        }
                    </Template>


                </GridEditSettings>
                <GridEvents OnToolbarClick="ToolbarClickHandler" OnActionComplete="OnComplete" TValue="CustomerDto" />
                <GridColumns>
                    <GridColumn Field=@nameof(CustomerDto.Id) Visible="false"></GridColumn>
                    <GridColumn Field=@nameof(CustomerDto.Name) HeaderText="Name" Width="200"></GridColumn>
                    <GridColumn Field=@nameof(CustomerDto.PhoneNumber) HeaderText="Phone" ValidationRules="@(new { required=true})" Width="150"></GridColumn>
                    <GridColumn Field=@nameof(CustomerDto.Address) HeaderText="Address" Width="200"></GridColumn>
                    <GridColumn Field=@nameof(CustomerDto.City) HeaderText="City" Width="160"></GridColumn>

                    <GridColumn HeaderText="Manage Records" Width="150">
                        <GridCommandColumns>
                            <GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-edit", CssClass="e-flat" })"></GridCommandColumn>
                            <GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-delete", CssClass="e-flat" })"></GridCommandColumn>
                            <GridCommandColumn Type="CommandButtonType.Save" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-save", CssClass="e-flat" })"></GridCommandColumn>
                            <GridCommandColumn Type="CommandButtonType.Cancel" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-cancel", CssClass="e-flat" })"></GridCommandColumn>
                            <GridCommandColumn ButtonOption="@(new CommandButtonOptions() { Content = "Approve", CssClass = "e-flat"})"></GridCommandColumn>
                        </GridCommandColumns>
                    </GridColumn>
                </GridColumns>
            </EjsGrid>
        </div>
    </div>
</div>



Attachment: ejgridmodel_8fef8551.7z

2 Replies

VI vijaymohan October 9, 2019 01:33 PM UTC

Dear Sir,

Its my mistake. its working

Thank you

Regards
Vijay



VN Vignesh Natarajan Syncfusion Team October 10, 2019 04:19 AM UTC

Hi VijayMohan,  

Thanks for contacting Syncfusion support.  

We are glad to know that you have resolve the query by yourself.  

Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan. 


Loader.
Live Chat Icon For mobile
Up arrow icon