WebForm与MVC

MVC 通过Controller可以传递数据到视图。这个在WebForm是比较难的,我的方法之一是通过Response.Redirect,而传递数据的方法包括使用QueryString,或通过Session。具体如下:

 

1             if (IsPostBack)
2             {
3                 GuestResponse guestResponse = new GuestResponse() { Name = txtName.Text };
4 
5                 Session["Value1"] = guestResponse;
6                 Response.Redirect("Thanks.aspx");
7 
8             }

 

posted @ 2021-05-19 23:34  开二哥  阅读(62)  评论(0)    收藏  举报