Is it possible to catch a postback in MVC method? Because every time my iframe postbacks, it does all my codes in my MVC method, such as getting data from the database; this is expensive.
in my html
<IFrame name="iframeReport" src="~/MVCController/MyMethod?param1=value1¶m2=value2"/>
MVCController.cs
public class MVCController: Controller { public ActionResult MyMethod(string param1, string param2) { // some codes here getting data from database return View(new MyModel(data)); } }
is it possible to know if it is a postback? some thing like this:
public class MVCController: Controller { public ActionResult MyMethod(string param1, string param2) { If(!isPostback) { // some codes here getting data from database } return View(new MyModel(data)); } }