Pass Parameter Value from Parent Views to Controller for Populate Partial View

Sometimes we require to pass parameter value from main view to controller and on depend of parameter controller load different data in to the partial view.

Suppose, I create a partial view for Year Control and on year type is different i.e. if year type is 1 then year range will be April to March, if year type is 2 then year range will be January to December.

For doing these, we write the below code in parent view:

parent view

Here GetFinyearData is the Action Name and Emporg is the Controller Name.

Then create the partial view:

partial view

Below is the Controller code:

Controller code

Here GetFinyearMonth return the list with Month Name as per finyear type.

Ebook Download
View all
Learn
View all