How to pass values from view to controller in ASP.NET MVC 3 (Razor)?

前端 未结 2 1507
旧时难觅i
旧时难觅i 2021-01-26 15:56

I have this table in database:

http://i.stack.imgur.com/C7CWX.png

And I display all value in \'music\' without repitions by this code(View):

@for         


        
2条回答
  •  渐次进展
    2021-01-26 16:17

    your Actionlink isn't quite doing what you want. If you hover over the links generated I think each one will name a different controller!

    http://msdn.microsoft.com/en-us/library/dd505070.aspx

    instead look at this version

    http://msdn.microsoft.com/en-us/library/dd493066.aspx

    @Html.ActionLink(item, "Deep", "YourController", new {id= ViewData["item"]})
    

    and a controller action like

    public ActionResult Deep(int id)
    {
      //Do something
    }
    

提交回复
热议问题