Cannot Add New Item

I've seen this new issue with my applications where I cannot add a new item.

I've also confirmed this doesn't work with the Sample Schema either.

I've just tried that using latest version of Radzen and it worked for me:




I started with a new project, new database and the latest version of Radzen.

Did you start with a new project and a new database or did you update existing ones?

Yep, that’s what I tried. Can you run the application with Visual Studio and check what’s the exception?

It hits the line.... if(!ModelState.IsValid)
and it returns return BadRequest(ModelState);

Item is null in the Post action. It is the same issue I see with my other Radzen applications.

[HttpPost]  [EnableQuery(MaxExpansionDepth=10,MaxAnyAllExpressionDepth=10,MaxNodeCount=1000)]
public IActionResult Post([FromBody] Models.Test123Data.Order item)
    {
        try
        {
            if(!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (item == null)
            {
                return BadRequest();
            }

            this.OnOrderCreated(item);
            this.context.Orders.Add(item);
            this.context.SaveChanges();

            return Created($"odata/Test123Data/Orders/{item.Id}", item);
        }
        catch(Exception ex)
        {
            ModelState.AddModelError("", ex.Message);
            return BadRequest(ModelState);
        }
    }
  }

Can you check using the debugger what's the error in ModelState?

First, I want to be sure we're on the same page. It is a WebAssembly .NET 5.0 application.

Second, when I create the CRUD pages, I'm checking all of the options.

As I recall, I started seeing these issues when (Blazor) Optimistic concurrency support was added.

Here's the value of ModelState.

Please let me know if you have any additional questions.

I appreciate your help.

I see there is 1 error in Errors - will you post it?

I see the following error in the controller code for all the tables (Orders, Order Details and Products):

"The 'odata.etag' instance or property annotation has a null value. In OData, the 'odata.etag' instance or property annotation must have a non-null string value."

Please re-infer your data source and turn off "Enable optimistic concurrency". We will investigate what's causing this error.

It works when Enable optimistic concurrency is unchecked.

On a side note, when it generates the Add Product screen, the Product Picture field is a textbox instead of allowing you to select a file name.

I appreciate your help.

Yes, only Create button will create pages with pictures during infer.

I'm not sure what you mean by "Create button."

During infer, I'm selecting Overwrite Existing Pages.

Isn't the Add Product screen where a Product is created?

It depends if you start the infer with Infer Schema or Create Sample Schema button:

I see.

I did a Create Sample Schema the first time.

All the following times, I did an Infer Schema.

Do you have a timeframe on when this will be fixed?

The problem with item create with enabled concurrency in WASM applications is already fixed and we will do our best to publish release before the end of the week.

Radzen update was released with fix included.