Ajax的“母版"和“子版"页面 [英] Master and Child page with Ajax
问题描述
我正在开发一个网站.我使用了母版页,并且动态创建了左侧菜单.当我单击该菜单时(用于显示另一页).我只想刷新contentPlaceholder.
在这里,我使用了Update Pannel,但是它无法正常工作.
I am developing a website. I have used Master Page and i have created left menus dynamically. When i Click on that menus(For displaying a another page). I want to refresh only contentPlaceholder.
Here i have used Update Pannel But its wont work.
推荐答案
您可以在没有母版页的情况下进行操作.其实我没有母版就做到了
使用Jquery.
Hi,
You can do it without master page. actually I did it without masterpage
using Jquery.
Default.aspx
<div class="maincontainer" align="center">
<div class="maincontainer ">
<table width="100%" align="center">
<tr>
<td>
<h2>Welcome to Website</h2>
</td>
</tr>
<tr>
<td>
<table width="100%" align="center">
<tr>
<td><a href="#home" onclick="openpage('home')">Home</a></td>
<td><a href="#about" onclick="openpage('about')">About Us</a></td>
<td><a href="#gallery" onclick="openpage('gallery')">Gallery</a></td>
<td><a href="#req" onclick="openpage('prayreq')">Request</a></td>
<td><a href="#contact" onclick="openpage('contact')">Contact Us</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div id="maincontent">
This is Home Page Content
</div>
</td>
</tr>
</table>
</div>
</div>
以及以上针对打开页面的javascript
And the above page javascript for openpage
function openpage(pagename){
( " ).text(" 页面加载中,请稍候...." );
("#maincontentdiv").text("Page Loading please wait.....");
(" ).load(页面名称+ " ,功能(){ // 使内容可见 }); }
("#maincontentdiv").load(pagename + ".aspx #maincontent", function () { // make content visible with effect }); }
并且您要加载的页面必须包含以下波纹div标签
And the page which you''ve to load must contain like bellow div tag
aboutus.aspx
<div id="maincontent">
This is About us content
</div>
如果使用相同的过程,则在加载部分页面时会获得最佳体验
您也可以在母版页中尝试.
一切顺利.
If you use the same process you''ll get best experience while loading partial page
You can try in master page also.
All the Best.
这篇关于Ajax的“母版"和“子版"页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!