0

i have this medthod:

 public ActionResult Edit(string Id) {

        return PartialView("Edit",Id);
    }

and myView:

<a class="openEditdialog" onclick="javascript:OpenWindow('@Url.Action("Edit", "RegisterBrand", new { Id = @item.Id})')" ></a>

but, i don't know why Id variable in Edit() is null????

Hello Sun
  • 133
  • 1
  • 4
  • 16

2 Answers2

2

Try This one i hope this will be helpful..

In view

<a href="@Url.Action("Edit", "Home", new { Id = @item.ID})">TestLink</a> 

In your Home controller

 public ActionResult Edit(int id)
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View();
        }
0

When returning a partial view and specifying the model i.e.

return PartialView("Edit",Id);

and Id is a string, then the reference to Model in your partial view will be a string, where your code suggests there is some magical object with an .Id property on it. Your view would use @Model to get the string. e.g.

<a href="@Url.Action("Edit", "RegisterBrand", new { Id = @Model })">link text</a>
David Fox
  • 10,603
  • 9
  • 50
  • 80