Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Razor page and update model through javascript

$
0
0

In my .NET razor page I have field like this:

<InputTextArea @bind-Value="Data.values" rows="4" />`  <button type="button" onclick="AddValues()"> Add </button>

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 click on the "Save" button I mean on form post event.

Does anybody have any idea how to update the model of the InputTextArea field when I click on AddValues(), so that when I am submitting the form, it would get latest values of the model and save that to the database?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>