[英]How to use Page_Load function in MVC
Previously in aspx
we have 以前在
aspx
我们有
protected void Page_Load(object sender, EventArgs e)
{
}
function which handled all page load events. 处理所有页面加载事件的函数。 But I do not know how this can be used in
MVC
. 但是我不知道如何在
MVC
使用它。 Can someone please help !!! 有人可以帮忙!!!
ASP.NET MVC
doesn't work on events like ASP.Net
. ASP.NET MVC
不适用于ASP.Net
事件。 There is no PageLoad Event
. 没有
PageLoad Event
。 Your controller action methods correspond to requests or view sent to the server. 您的控制器操作方法与发送到服务器的请求或视图相对应。 You need to build the equivalent control in
HTML
, and then use a FORM
to HttpPost
the data to the server, where it is handled by a controller method. 您需要在
HTML
构建等效的控件,然后使用FORM
将数据HttpPost
到服务器,由控制器方法处理该数据。 Similarly HttpGet
is used to get data using controller method. 同样,
HttpGet
用于使用控制器方法获取数据。
I suggest you this link to get started with MVC 我建议您使用此链接来开始使用MVC
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.