0
私はMVCを初めてお使いです。誰でもHtml.ActionLinkとAjax.ActionLinkの違いを説明できますか?Html.ActionLinkとAjax.ActionLinkの違い
私はMVCを初めてお使いです。誰でもHtml.ActionLinkとAjax.ActionLinkの違いを説明できますか?Html.ActionLinkとAjax.ActionLinkの違い
基本的に両方とも完全に機能します。これらの主な違いは、 -
Html.ActionLink - ビューに新しいリンクを作成し、ユーザーがリンクをクリックするとビューに直接リンクせず、そのまま通過するMVCルーティング。ルーティングによってアクションメソッドにマップされます。
Html.ActionLink(test.login,
"Action", // ActionMethod Name
"Login", // Controller Name.
new { person.loginId}, // Route arguments.
null // <-- htmlArguments .. which are none. You need this value
// otherwise you call the WRONG method ...
// (refer to comments, below).
)
Ajax.ActionLink:Ajax.ActionLinkも視野に新しいリンクを作成しますが、ユーザーがクリックしたときAjax.ActionLinkは、代わりに新しいURLに移動の非同期要求を送信します。 Ajax.ActionLinkでは、どのコントローラのアクションメソッドを呼び出すかを指定し、アクションメソッドから返されるレスポンスの処理方法も指定します。
@Ajax.ActionLink("Customer from Germany", // <-- Text to display
"Germany", // <-- Action Method Name
new AjaxOptions
{
UpdateTargetId="CustomerList", // <-- DOM element ID to update
InsertionMode = InsertionMode.Replace, // <-- Replace the content of DOM element
HttpMethod = "GET" // <-- HTTP method
})
希望すればお手伝いします。 これをより理解していただくためには、Article