English 中文(简体)
如何根据目前的路线价值建立行动联系?
原标题:How to create action links based on current route values?

我的网页是http:// localhost:5947/Employer/Edit? CarloinID=41,并从该网页上链接到@Html.ActionLink(“Change 密码”、“change_pass”、“Employer”);,转贴到更改密码。

我如何从编辑页到改动密码上通过<条码>日志?

最佳回答
@Html.ActionLink(
    "Change password", 
    "change_pass", 
    "Employer", 
    new { LoginID = Request["LoginId"] }, 
    null
)

当时说,将原木作为直线参数,引起了对你申请安全的一些严重关切。

问题回答

您需要使用<代码>ActionLink超载,使您能够确定路线价值。 例如,你可以做到:

@Html.ActionLink(
    "Change password", 
    "change_pass", 
    "Employer", 
    new { LoginID = Request["LoginID"] }, 
    null)

但是,你不能直接查阅<代码>Request[“LoginID”],从而可以改进这方面的情况。 为此,<代码>的模式 Edit view has a property for the current CarloinID and use that property otherwise.





相关问题
How to update shared view adminheader.cshtml from a model

I ve added a drop down into my shared adminheader.cshtl view and it needs to be dynamically updated from data from a table. So when I use another view like routeplan.cshtml I load the view from ...

ASP.NET MVC Razor view engine

After reading Scott Guthrie s blog entry about the new Razor view engine for ASP.NET MVC and reading this question comparing the available view engines. Razor seems to address most of the problems ...

Client Id for Property (ASP.Net MVC)

I m trying to do a label for a TextBox in my View and I d like to know, how can I take a Id that will be render in client to generate scripts... for example: <label for="<%=x.Name.ClientId%>"...

Get Current Area Name in View or Controller

How do you get the current area name in the view or controller? Is there anything like ViewContext.RouteData.Values["controller"] for areas?

MVC which submit button has been pressed

I have two buttons on my MVC form: <input name="submit" type="submit" id="submit" value="Save" /> <input name="process" type="submit" id="process" value="Process" /> From my Controller ...

热门标签