razor page and update model through javascript

  Kiến thức lập trình

In my .net razor page I have field like below:
<InputTextArea @bind-Value="Data.values" rows="4" />

<input type="button" onclick="AddValues()" /> 

Here AddValues is a JavaScript function and click of this hardcoded values gets assigned to the field like some pretext “—-” and insert the value in the InputTextArea field.

But since model is assigned to the field Data.values it does not get updated when I am click on Save button I mean on form post event.

Anybody has idea on how to update the model of InputTextArea field when I am clicking on AddValues() so when I am submitting the form it would get latest values of the model and saves in the database?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT