I am using asp.net core razor engine. After I enter text in my TextArea and hit the submit button I want to clear the text in the TexArea. I have not been able to find anything on how to do this using html or c#. Here is my code for the TextAreaFor
<h1>Add Your Comment</h1>
@using(Html.BeginForm("AddComment","Home"))
{
<p>
<label>Your Comment</label>
@Html.TextAreaFor(d=>d.comment)
@Html.ValidationMessageFor(d => d.comment)
</p>
<input type="submit" name="submit" value="Add my Comment!"/>
}
Here is my controller for AddComment
[HttpPost]
[Route("addComment")]
public IActionResult AddComment(Messages model)
{
var user_id = HttpContext.Session.GetString("Id");
if(user_id == null){
return RedirectToAction("Index");
}
model.Users_id = Convert.ToInt32(user_id.ToString());
userFactory.addComment(model, user_id);
setTempData();
ViewBag.Messages = userFactory.FindAll();
model.comment ="";
return View("Login", model);
}
The calls for userFactory work, it is a call to my factory that talks to my db