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

Setting of Edit Params for a EditType does not compile

As per example of https://ej2.syncfusion.com/blazor/documentation/grid/editing/#cell-edit-type-and-its-params

When the Client project is set to .Net Standard 2.0, the code does not compile.

When set to .Net Standard 2.1, the code CAN compile, but the IDE is not happy of it - showing messages:

Anonymous Types: 'a is new { NjsNumericTextBox<int> params }
',' or '}' expected

I am currently on .Net core 3.1 Preview, with Syncfusion's 3.1 components as well.

Resharper has been installed - latest 2019.2.3

VisualStudio currently on 2019 - 16.3.6

Is it related to Visual studio or Resharper or something else?

3 Replies

VN Vignesh Natarajan Syncfusion Team October 28, 2019 07:40 AM UTC

Hi Nick,  
 
Greetings from Syncfusion support.  
 
Query: “When the Client project is set to .Net Standard 2.0, the code does not compile. && When set to .Net Standard 2.1, the code CAN compile, but the IDE is not happy of it - showing messages 
 
As per your suggestion we have prepared a Client Side Blazor application using the code example provided in the documentation. We are not able to reproduce the reported issue at our end. Kindly download the sample which we have prepared using .Net Core 3.1 Preview 1 and Syncfusion latest Nuget package (17.3.0.19-beta) from below. 
 
 
Kindly ensure that you have referred same version of script files and Nuget Package. 
 
    <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.3.19/fabric.css" rel="stylesheet" /> 
    <script src="https://cdn.syncfusion.com/ej2/17.3.19/dist/ej2.min.js"></script> 
 
 
After referring the sample, If you are still facing the issue kindly get back to us with following details.  
 
  1. Share the screenshot of script error with full stack trace.
  2. Share your Syncfusion package version.
  3. If possible try to reproduce the reported issue in provided sample or share the issue reproducible sample.     
 
Regards, 
Vignesh Natarajan. 



NW Nick Wong replied to Vignesh Natarajan October 29, 2019 02:36 AM UTC

Hi Nick,  
 
Greetings from Syncfusion support.  
 
Query: “When the Client project is set to .Net Standard 2.0, the code does not compile. && When set to .Net Standard 2.1, the code CAN compile, but the IDE is not happy of it - showing messages 
 
As per your suggestion we have prepared a Client Side Blazor application using the code example provided in the documentation. We are not able to reproduce the reported issue at our end. Kindly download the sample which we have prepared using .Net Core 3.1 Preview 1 and Syncfusion latest Nuget package (17.3.0.19-beta) from below. 
 
 
Kindly ensure that you have referred same version of script files and Nuget Package. 
 
    <link rel='nofollow' href="https://cdn.syncfusion.com/ej2/17.3.19/fabric.css" rel="stylesheet" /> 
    <script src="https://cdn.syncfusion.com/ej2/17.3.19/dist/ej2.min.js"></script> 
 
 
After referring the sample, If you are still facing the issue kindly get back to us with following details.  
 
  1. Share the screenshot of script error with full stack trace.
  2. Share your Syncfusion package version.
  3. If possible try to reproduce the reported issue in provided sample or share the issue reproducible sample.     
 
Regards, 
Vignesh Natarajan. 


OK, thanks!
I realized it is just resharper showing the message on editor only.
After disabing it, the messages are gone.

Furth
- can you let me know why the params is actually the component itself?
- If i intend to declare inline at GridColumn:
   <GridColumn ....   EditType="EditType.NumericEdit" Edit="@(new { @params = new EjsNumericTextBox<int>() { Decimals = 3, Value = 4 } })"> <GridColumn>
  is there any cleaner declaration that i can skip the EjsNumericTextBox<int> part? (for example something like: @(new { @params = new  { Decimals = 3, Value = 4 } }) - doesnt work as tried)
- Also, when declaring those params in the code block, do you see the indentation broken?


RN Rahul Narayanasamy Syncfusion Team October 29, 2019 10:38 AM UTC

Hi Nick, 
 
Thanks for your update. 
 
Query: can you let me know why the params is actually the component itself? 
 
We have provided Edit params using component class for better suggestions to know available properties. 
 
Query: is there any cleaner declaration that i can skip the EjsNumericTextBox<int> part? (for example something like: @(new { @params = new  { Decimals = 3, Value = 4 } }) - doesnt work as tried) 
 
Yes, you can modify the EjsNumericTextBox properties by skipping EjsNumericTextBox<int> part. But you need to define the properties in lowercase because it will be serialized. Find the below code snippets for your reference. 
 
[code snippets] 
<EjsGrid DataSource="@OrderData" Toolbar=@ToolbarItems> 
    <GridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true"></GridEditSettings> 
    <GridColumns> 
        ... 
       <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" EditType="EditType.NumericEdit" Edit="@(new { @params = new  { decimals = 3, value = 4 } })" TextAlign="TextAlign.Center" Width="130"></GridColumn> 
        ... 
   </GridColumns> 
</EjsGrid> 
 
 
Query: when declaring those params in the code block, do you see the indentation broken? 
 
If you want to define edit params in code block, then you can define and escape the @ in the params like in the below code snippets. If you face indent problem after escaping please give us more details on this problem. 
 
 
<EjsGrid DataSource="@OrderData" Toolbar=@ToolbarItems> 
    <GridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true"></GridEditSettings> 
    <GridColumns> 
        ... 
       <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" EditType="EditType.NumericEdit" Edit="@FreightEditParams" TextAlign="TextAlign.Center" Width="130"></GridColumn> 
        ... 
   </GridColumns> 
</EjsGrid> 
 
@code{ 
    public string[] ToolbarItems = new string[] { "Add", "Edit", "Delete", "Update", "Cancel" }; 
 
    public object FreightEditParams = new 
    { 
          @@params = new EjsNumericTextBox<int>() { Decimals = 3, Value = 4 } 
    }; 
 
    ... 
 
... 
} 
 
Please get back to us if you need further assistance. 
 
Regards, 
Rahul 
 


Loader.
Live Chat Icon For mobile
Up arrow icon