viewmodelオブジェクトを使用してデータをアクションに送り、別のビューを返す方法。アンカータグmvcにjson文字列を渡す方法5
jsonの文字列をindex.cshtmlページからアクションに送信し、リダイレクトするか、viewmodelオブジェクトのTax.cshtmlページに戻したいと思います。 かみそり:
<li class="mt5"><a id="noOfCart" href="@Url.Action("ReviewOrder", "Tax",new {storedTaxyear=localStorage.getItem("taxyear")})"><i class="fa fa-shopping-cart fa-lg hover1 textwhite"></i><span class="shoppingbadge"></span></a></li>
コントローラ
public ActionResult ReviewOrder(string storedTaxyear)
{
ViewBag.FormName = 1;
ServicesCategoryList objviewmodel = new ServicesCategoryList();
return View("Tax", objviewmodel);
}
存在しないのlocalStorageを示している
Razor変数にJavascript変数を渡すことはできません。最初に隠しフィールドにlocalStorage.getItem( "taxyear")を入れてからタグ – Kostis