機能があり@heper pagination
ます。これは、2つのViewヘルパーViewBag
とを持っていますUrl
。このページ付けは非常に多くのページで使用されるため、コードをViews
フォルダーからフォルダーに移動しApp_Code
ます。内部のコードApp_Code/Helper.cshtml
@helper buildLinks(int start, int end, string innerContent)
{
for (int i = start; i <= end; i++)
{
<a class="@(i == ViewBag.CurrentPage ? "current" : "")" href="@Url.Action("index", "country", new { page = i })">@(innerContent ?? i.ToString())</a>
}
}
しかし今、私がアプリを実行すると。エラーをスローします
error CS0103:The name 'ViewBag' does not exist in the current context
error CS0103:The name 'Url' does not exist in the current context
名前空間をインポートする必要がありますか、それとも問題がどこにあるのですか?
私がやりたい方法は完璧ですか?