18 April 2014

Action Methods Parameters -- Basics MVC(Model View Controller)

      Request and Response methods can be called from the action method of the controller. If the parameter to an action method is passing through the URL, there are several ways to access it into our action method.

The below code explains how to use Request object to access the query-string value
.

Public void Register ()
{
  Int id=Convert.ToInt32 (Request [“Id”]);
}

NoN-Action Methods:

All action methods in a Controller are defined as public method. If you want some method as non-action method, then mark the method with NonAction Attribute 

[NonAction]
Private void function_name ()
{
//Method Logic
}

No comments:

Post a Comment