Orion Rigel
Orion Rigel

Reputation: 95

Passing two parameters using MVC

I want to pass two parameters from one page to other page. I am able to pass single parameter. when it comes to two parameters, i get the error http 404 could not found. My View

My Code What I want to achieve here is, I want to share trainer id and title to the next page. When i put , it gives me error like HTTP 404 .

Kindly help me with this.

Thanks

Upvotes: 1

Views: 205

Answers (2)

Imad
Imad

Reputation: 7490

Use

href="<%: Url.Action("DetailedTrainerView", "CategoryTrainer", new { trainerID = @item.TrainerID, title = @item.Title }) %>"

and make sure your action method has same parameter name and sequence.

Upvotes: 0

Captain0
Captain0

Reputation: 2613

Maybe replace your hyperlink with

 <a href="@Url.Action("DetailedTrainerView","CategoryTrainer",new
                                        {
                                            [email protected],
                                            [email protected]
                                        })>Link text</a>

Upvotes: 2

Related Questions