英文:
How to prevent values on get from reset when press submit button?
问题
I work on razor page asp.net . I face issue my issue values on get reset after click submit button so when click submit button and check values on POST I found it become null
so How to avoid this behavior OR with another meaning how to retain values on get without reset when click submit button
from my debug details as below
1 - when page load i check user id it have value 9595
public void OnGet()
{
string MyUserData = Request.Cookies["myUserData"];
UserAuthResponse? userAuthResponse = System.Text.Json.JsonSerializer.Deserialize
string UserID = userAuthResponse.Data.UserID;
}
2 - Now I will click submit button so break point hit on post method
public async Task OnPost(UC.ADC.Core.Entities.SQL.Branch branch)
{
//userAuthResponse.Data.UserID become null
}
when check values of userAuthResponse.Data.UserID
it become null
so how to preserve or retain value of userAuthResponse.Data.UserID
after make get to use it on post method
form view as below :
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论