Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new in MVC. I have created an index page of leave application of employees. Single employee has multiple leave types like CL,SL,CML,etc. The index page contains empid (Foreign Key), emp name,different leave types(Foreign Key) with their balance and SNO(i.e the primary key ). when I click to edit the record it should redirect to edit page with the primary key but i want to pass multiple values(i.e different primary keys). So, I'm stuck here. Please help him to resolve my problem.
Posted
Updated 2-Feb-16 0:23am
v2

1 solution

View

@{  
    RouteValueDictionary ids = new RouteValueDictionary();
    ids.Add("id[0]", 1);
    ids.Add("id[1]", 2);
    ids.Add("id[2]", 3);
}

@Html.ActionLink("Click", "MyAction", "Home", ids, null)


Controller

C#
public ActionResult MyAction(int[] id)
{
    foreach(int x in id)
    {
        System.Diagnostics.Debug.WriteLine(x);
    }

    return View();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900