How to call action method using query string in mvc

442 views Asked by At

enter image description here

Question: when new employee created I have to send mail to the admin. right now mail sending successfully but when admin clicks the link directly it should open the created employee partial view along with partial 1 and partial view 2 for your reference please find below the image.

i dont know how to do this one. right now directly i called the action method Example:

it should call the following action method

  1. //websitename/seachcountry
  2. //websitename/listofemployee
  3. //websitename/emplyesearchbyid

which is the best way to call from the email link. Thanks.

1

There are 1 answers

0
corix010 On BEST ANSWER

To answer your question, to call an action using query string, your action should look like the following in your controller:

public ActionResult EmployeeInfo(string query)
{
    // use query here
}

However, I suggest create an employee details action and view that would correspond to route like //websitename/employee/details/id.

This view must be tied to a viewmodel that contains all required info about the employee (including the data in partial views).