# Cannot Add New Item

**URL:** <https://forum.radzen.com/t/cannot-add-new-item/6327>\
**Category:** Blazor WebAssembly\
**Created:** [January 17, 2021, 10:10pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327 "2021-01-17T22:10:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 17, 2021, 10:10pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/1 "2021-01-17T22:10:07Z")

</div>

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.

 ![radzen-error](https://forum.radzen.com/uploads/default/original/2X/a/a85759eb0e5da497e90df966021af0a75230dbb0.jpeg)

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 18, 2021, 7:34am UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/2 "2021-01-18T07:34:45Z")

</div>

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

 ![image](https://forum.radzen.com/uploads/default/original/2X/5/5e6fe88d780ecb44f9ad8ba514ddc9e78ef7048d.png)  
 ![image](https://forum.radzen.com/uploads/default/original/2X/4/422386b1c152b63159b1bb109e0c9d02a9f9c26d.png)  
 ![image](https://forum.radzen.com/uploads/default/original/2X/3/32702ba111d9c3a82c794ef1736c4a78db1d39ed.png)  
 ![image](https://forum.radzen.com/uploads/default/original/2X/c/c2da896dc6fd46f8f42289acf9ca7fb53b033159.png)

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 18, 2021, 5:49pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/3 "2021-01-18T17:49:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 18, 2021, 6:15pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/4 "2021-01-18T18:15:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 19, 2021, 1:00am UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/5 "2021-01-19T01:00:32Z")

</div>

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);
        }
    }
  }
```

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 19, 2021, 9:19am UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/6 "2021-01-19T09:19:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 19, 2021, 1:29pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/7 "2021-01-19T13:29:29Z")

</div>

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.

 ![radzen-CRUD-selected-options](https://forum.radzen.com/uploads/default/original/2X/1/1a905140bb714ad7154bf1e979670f28f980242a.jpeg)

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

Here's the value of ModelState.

 ![Radzen-Model-State](https://forum.radzen.com/uploads/default/original/2X/7/7e216b87b466c25e48f3ec4eb6a4156547d976e7.jpeg)

Please let me know if you have any additional questions.

I appreciate your help.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 19, 2021, 1:36pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/8 "2021-01-19T13:36:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 19, 2021, 1:40pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/9 "2021-01-19T13:40:50Z")

</div>

![Radzen-Error](https://forum.radzen.com/uploads/default/original/2X/a/ada7c36ac988ca901eab9ab036f6efc8405be8ee.png)

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 19, 2021, 1:45pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/10 "2021-01-19T13:45:26Z")

</div>

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."

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 19, 2021, 2:01pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/11 "2021-01-19T14:01:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 19, 2021, 2:08pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/12 "2021-01-19T14:08:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 19, 2021, 2:10pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/13 "2021-01-19T14:10:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 19, 2021, 2:52pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/14 "2021-01-19T14:52:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 19, 2021, 2:54pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/15 "2021-01-19T14:54:25Z")

</div>

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

 ![image](https://forum.radzen.com/uploads/default/original/2X/e/e7e9b47a1866b7c927a7b390b063d93f89b695a1.png)

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 19, 2021, 3:23pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/16 "2021-01-19T15:23:17Z")

</div>

I see.

I did a Create Sample Schema the first time.

All the following times, I did an Infer Schema.

---

<div class="post-metadata">

**Author:** ![SteelPhantomDude](https://forum.radzen.com/user_avatar/forum.radzen.com/steelphantomdude/32/3154_2.png) [@SteelPhantomDude](https://forum.radzen.com/u/SteelPhantomDude)\
**Post date:** [January 20, 2021, 12:26pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/17 "2021-01-20T12:26:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 20, 2021, 1:05pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/18 "2021-01-20T13:05:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 20, 2021, 2:53pm UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/19 "2021-01-20T14:53:37Z")

</div>

> [@enchev](#):
>
> The problem with item create with enabled concurrency in WASM applications

Radzen update was released with fix included.

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [November 14, 2023, 6:57am UTC](https://forum.radzen.com/t/cannot-add-new-item/6327/20 "2023-11-14T06:57:23Z")

</div>


