Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pageload event in MVC

I have webform code as below.I need to have this in mvc.. What to use to initialize objext in pageload event in asp.net mvc

  protected void Page_Load(object sender, EventArgs e)
    {
        Control ctrl = (Control)Session["ctrl"];
        PrintHelper.PrintWebControl(ctrl);
    }
like image 728
Thyag Ann Avatar asked Oct 03 '22 08:10

Thyag Ann


1 Answers

ASP.NET MVC doesn't work on events like ASP classic; there's no "pageload event". Your controller methods correspond to requests sent to the server. You'll need to build the equivalent control in HTML, and then use a form to HTTP POST the data to the server, where it is handled by a controller method.

like image 78
anaximander Avatar answered Oct 06 '22 00:10

anaximander