如何在提交中使用@ Url.RouteUrl?

时间:2015-05-20 10:25:14

标签: asp.net-mvc

我有一个以下的div:

WITH MEMBER [Measures].[CoinInRank] AS CASE 
WHEN [Measures].[Total Amount Bet] <= @FrequentMinValue   AND [Measures].[Total Amount Bet] > 0 THEN "Casual"
WHEN [Measures].[Total Amount Bet] > @FrequentMinValue AND [Measures].[Total Amount Bet] <=  @FrequentMaxValue THEN "Frequent"
WHEN [Measures].[Total Amount Bet] >  @FrequentMaxValue THEN "Avid"
END MEMBER 

我想删除链接并将其替换为按钮。 如何在提交按钮中移动所有内容?

2 个答案:

答案 0 :(得分:0)

您可以使用以下代码:

@if (Model.Id == 0)
{
    <form action="@Url.RouteUrl(...)" method="get">
        <button type="submit">Change your address</button>
    </form>
}

答案 1 :(得分:-1)

@if (Model.Id == 0)
        {
            <input type="button" name="change" class="button " value="@T("Change")" 
                   onclick="setLocation('@Url.RouteUrl("CustomerAddressEdit", new {Model.AddressId})')" />
        }

就是这样。