Hi @Blooming Developer ,
According to your description, I suggest you could try to use jquery ajax post method to achieve your requirement. By using this, post method will not refresh the whole page.
More details, you could refer to below codes sample:
Razor pages:
<form asp-page-handler="SubmitChat">
<div class="form-group mt-2">
<label for="TxtAreaChatBox"><b>Leave Your Comments</b></label>
<textarea asp-for="Comments" class="form-control" id="TxtAreaChatBox" rows="4"></textarea>
<input id="hdnCommentReqID" type="hidden" asp-for="RequestID" value='111' />
</div>
<div class="modal-footer">
<button type="reset" class="btn btn-danger" data-dismiss="modal"><i class="fas fa-window-close mr-2"></i> Cancel</button>
<button type="submit" class="btn btn-primary" id="btnpost">Submit</button>
</div>
</form>
Js:
Codes sample for js :
Backend-codes:
Notice: you should modify the codes according to your actually post parameter.
public IActionResult OnPostSubmitChat(string Comments, string RequestID) {
return new OkResult();
}