---
title: "Explain Action Method parameter?"  
description: "Explain Action Method parameter?"  
author: "Anonymous User"  
published: 2020-01-30  
updated: 2020-01-30  
canonical: https://www.mindstick.com/forum/155764/explain-action-method-parameter  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 2 minutes  

---

# Explain Action Method parameter?

Tell me about [Action](https://www.mindstick.com/forum/155752/what-is-action-result-with-its-types) [Method in Asp.Net](https://www.mindstick.com/forum/12764/can-t-pass-formcollection-to-create-method-in-asp-dot-net-mvc) [MVC](https://www.mindstick.com/forum/155803/define-cache-profile-in-mvc) with a suitable example [as well as](https://www.mindstick.com/interview/2481/can-you-write-a-java-class-that-could-be-used-both-as-an-applet-as-well-as-an-application) a suitable image.

## Replies

### Reply by Nishi Tiwari

**Action parameters** are defined as the variables which are used to retrieve user-requested values from the URL.

The parameters are easily retrieved from the request's data collection. Parameters may include name or value pairs for data, query string value, etc. the controller class will locate for the values of the parameters based on the RouteData instance. If the value will present, it will be passed to the parameter else exception will be thrown.

The Controller class gives two properties **[Request and Response](https://www.mindstick.com/forum/155763/what-is-asp-dot-net-mvc-controller)** which can be used to get handle user requests and responses.

## Example

Here, we are going to create an [action method](https://www.mindstick.com/forum/160300/how-to-pass-data-to-an-httppost-action-method-in-a-dot-net-core-api) in the controller. This action method will have a parameter. The controller code may look like this:

## // MusicStoreController.cs

```
1.	using System;
2.	using System.Collections.Generic;
3.	using System.Linq;
4.	using System.Web;
5.	using System.Web.Mvc;
6.	namespace MvcApplicationDemo.Controllers
7.	{
8.	    public class MusicStoreController : Controller
9.	    {
10.	        // GET: MusicStrore
11.	        public ActionResult Index()
12.	        {
13.	            return View();
14.	        }
15.	        public string ShowMusic(string MusicTitle)
16.	        {
17.	            return "You selected " + MusicTitle + " Music";
18.	        }
19.	    }
20.	}
```

## Output:

In URL, we must have to pass the parameter value and we will do it by this URL localhost:port-no/MusicStore/ShowMusic?MusicTitle=Classic.

It will give the following output:-

![Explain Action Method parameter?](https://www.mindstick.com/mindstickforums/b77f67eb-5c32-4792-8808-3c525298951a/images/deed802f-3176-4c3d-aa94-9f6b273112a3.png)\


---

Original Source: https://www.mindstick.com/forum/155764/explain-action-method-parameter

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
