使用Ajax.ActionLink时,点击对应的按钮会重新加载一个页面,而不是在当前页面的指定模块加载_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:52:05
Original
1073 people have browsed it

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>@ViewBag.Title</title>    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />    <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>    </head><body>    <div class="page">        </div>        <div id="Main">            <ul id="menu">                <li>@Ajax.ActionLink("登录系统", "Logon", "Account", null, new AjaxOptions() { UpdateTargetId = "main" }, new { @style = "" })|</li>            </ul><div id="main">            </div>        </div>    </div></body></html>
Copy after login

AJAX 是在不重新加载整个页面的情况下,与服务器交换数据并更新部分网页的艺术。可是,在上面的代码中,点击“登录系统”后,却不是料想之中的在指定的模块“main"中更新加载,而是重新加载了一个页面。

解决办法:在

中添加引用:

重新生成解决方案,问题解决。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!