Get numeric value on Datalist

Good Day

I created a product list using the Datalist component which has some text, numeric component and a button. On the button click I add a record to a table for the cart lines.

What I cannot seem to figure out it how to get a value from a numeric component.

What would be the best approach to this.

Any assistance will be appreciated.

The best approach is to set the Value property of the Numeric component to a property of your data item. e.g. ${data.NumericValue}.

I did consider this but was unable to figure out if it was possible to "add" a field to the data property as currently it is all the fields from the product information.

How would I add that additional "field"?

You need to add a new property to the class that Radzen has generated. Add a new partial class with the same name and namespace and the extra property:

  1. Create a new file in the server\Models directory e.g. Product.Partial.cs
  2. Create a partial class with the same namespace as your original one
using System.ComponentModel.DataAnnotations.Schema;

namespace YourAppName.Models.DataSourceName
{
    public partial class Product
    {
          [NotMapped] // Instruct Entity Framework not to persist this property in the database
          public int NumericValue { get; set; }
    }
}