I am working on ASP.NET MVC project. I am facing one problem now. I am redirecting from one action to other when I click on Add list option in my drop down.
This is the script I am using for redirection :
$("#DrpList").change(function (e) {
if ($(this).val() == 'Add List') {
document.location.href = 'http://localhost:1234/report/Index/indexid'
Here indexid is just random id which I am passing and it is static, So I can compare this in my Index controller and display view I need.
Here what I want is, after i pass indexid parameter to index, when Index page displays, I can see indexid in my link like this,
http://localhost:1234/report/Index/indexid
but i just need to display,
http://localhost:1234/report/Index
I tried to do like :
return view("Index", "report", new{id = ""});
But it doesn't work. So how can I achieve this ?
Update :
public ActionResult Index(string id)
{
if (id == "indexid")
{
//Here Add items to list
return View("Index", "report", new { id = "" });
}