shifa fatima
shifa fatima

Reputation: 63

How to use Page_Load function in MVC

Previously in aspx we have

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. Can someone please help !!!

Upvotes: 2

Views: 1427

Answers (1)

Rahul Nikate
Rahul Nikate

Reputation: 6337

ASP.NET MVC doesn't work on events like ASP.Net. There is no 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. Similarly HttpGet is used to get data using controller method.

I suggest you this link to get started with MVC

Upvotes: 3

Related Questions