English 中文(简体)
我如何使用Html。 行动?
原标题:How can I use Html.Action?

我试图理解如何使用:

@Html.Action("GetOptions", )

我谨向我的控制者发出呼吁,并通过参数:

pk = "00" and rk = "00"

一些人可以解释我如何能够与Html一起这样做。 行动

最佳回答

http://msdn.microsoft.com/en-us/library/ee703457.aspx” rel=“noretinger”Action方法;它作了很好的解释。 对您来说,这应当做到:

@Html.Action("GetOptions", new { pk="00", rk="00" });

<控制代码>参数>将不落到控制器身上,正在援引<代码>Html.Action。 因此,如果你再次试图从另一个控制者那里援引一项行动,那么你就不得不具体说明控制者的名称。

@Html.Action("GetOptions", "ControllerName", new { pk="00", rk="00" });
问题回答

first, create a class to hold your parameters:

public class PkRk {
    public int pk { get; set; }
    public int rk { get; set; }
}

然后使用<代码>Html.Action通过参数:

Html.Action("PkRkAction", new { pkrk = new PkRk { pk=400, rk=500} })

主计长办公室

public ActionResult PkRkAction(PkRk pkrk) {
    return PartialView(pkrk);
}

Another case is http redirection. If your page redirects http requests to https, then may be your partial view tries to redirect by itself.

It causes same problem again. For this problem, you can reorganize your .net error pages or iis error pages configuration.

仅能确保你将申请改写为正确错误,或找不到网页,并确保这一错误页含有不成问题的部分。 如果你的网页仅支持https,如果不使用https,则不会提出错误页数的要求,如果错误的页数包含部分内容,那部分内容试图从请求的圆顶上调取方向,则会造成问题。





相关问题
WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

Post back complex object from client side

I m using ASP.NET MVC and Entity Framework. I m going to pass a complex entity to the client side and allow the user to modify it, and post it back to the controller. But I don t know how to do that ...

Create an incremental placeholder in NHaml

What I want to reach is a way to add a script and style placeholder in my master. They will include my initial site.css and jquery.js files. Each haml page or partial can then add their own required ...

asp.net mvc automapper parsing

let s say we have something like this public class Person { public string Name {get; set;} public Country Country {get; set;} } public class PersonViewModel { public Person Person {get; ...

structureMap mocks stub help

I have an BLL that does validation on user input then inserts a parent(PorEO) and then inserts children(PorBoxEO). So there are two calls to the same InsertJCDC. One like this=>InsertJCDC(fakePor)...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

热门标签