I’m trying to get the value of what the user has inputted in my textarea on my page and store that value as a string in a variable.
I have spent over an hour doing research on all different ways of getting the value from a textarea in C# and tried many combinations of example code and tried to adapt it to mine but neither of them work. Either the library doesn’t exist anymore or something is wrong with example code and I don’t want to fix something that is 8+ years old.
Is there any new ways in 2022 to get the value in my razor page textarea and store it in a string so I can re-use it for my needs?
I have seen the post on stack overflow that has been posted over 8+ years and it doesn’t work or I’m implementing it wrong.
2
Answers
you can put that in a javascript function then gets called on onlcick (like a submit button) and or on the textarea as OnTextChanged.
You have to provide the textarea’s Id or use the Html helper method to get it. Here is a working example: