Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
I have a windows application that has a link when clicked it sends two parameters to an MVC application and both need to be displayed. The parameters are on the URL like this:

http://localhost:49224/AbsaFlexi/Intro?Name=L%20Dube&Employee=PSHA2518

AbsaFlexi is the name of my controller and Intro is the ActionMethod in the AbsaFlexi controller. I would like to know if I can use another ActionMethod to accept the same parameters to display in another View without specifying the Controller and ActionMethod in the URL provided above? Below is my Intro ActionMethod in the AbsaFlexi Controller which accepts the parameters:

C#
public ActionResult Intro(string Name, string Employee)
       {
           if (!string.IsNullOrEmpty(Name) || !string.IsNullOrEmpty(Employee))
               Session["Name"] = Name;
               Session["Employee"] = Employee;

               string strName = string.Empty;
               string strEmployee = string.Empty;

                if (Session["Name"] != null)
                   strName = Session["Name"].ToString();
                if (Session ["Employee"] != null)
                   strEmployee = Session["Employee"].ToString();

           ViewBag.ClientFirstName = strName;
           ViewBag.Employee = strEmployee;


             return View();
       }
Posted

1 solution

yes it is possible to add another actionmethod with same parameter..
Also u can set another view from the new action method..
 
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