Discard value with inline grid

Good morning,

We have several pages built with Inline Grid, linked to a SQL database. Creating / Updating a line is working fine, but when we try to remove a value from a column, it fails. We observed this error with a numeric column. For exemple, if for column ID I previously had the value 1, and I want to remove this value (blank), Radzen returns us that it failed

When we check with a profiler in SQL what was sent to the database, we can see that the request doesn't reach the database.

Is there a way to remove the value from a column?

Best Regards,
Yoann

Most probably you are trying to set null to a non-nullable column. Radzen won't allow that. Make sure the column is nullable and so is the generated property type. For example the integer should be int? MyPropert { get; set; }

The column is defined like this:

[Column("CORN OIL MOISTURE CONTENT")]

public double? CORNOILMOISTURECONTENT
{
  get;
  set;
}

And the column in the database is also set to allow nulls values (Even if it doesn't seem to reach the database)

Good morning,

Do you see any reason from the configuration above that would explain why we can't remove a value in columns?

No, I don't see any reason why it won't clear the value. You can attach a debugger and check what's going on. Alternatively if you own a Radzen subscription you can send us the project and a db backup or SQL create script to troubleshoot.

Thank you for the tip.

After looking at the debugging, it looks like the value is retrieved as an empty string instead of a null value (The element JOADMINNATURALGASMETER in the element after this is also configured as a double that allows null values)

image

Is there an option we would be missing somewhere that convert empty strings to null values? (Or are we not having the right approach when trying to remove the value from this column?)

There isn't an option that converts empty strings to null automatically. You can do that in the Submit event of the form though. Add an action before invoking the data source method which updates the data that sets the field to null if it is empty string.