日期:2014-05-16 浏览次数:20704 次
/*说明文件*/
--news.aspx前台文件
--news.aspx.cs后台C#文件
--new.js就是这个AJAX文件
<script src="Scripts/new.js" type="text/javascript"></script>
<!--网页左侧-->
<asp:Repeater ID="RepMenus" runat="server">
<ItemTemplate>
<li><span>
<a href="#" id="MeusID" mid="<%#Eval("ID"%>" onclick="meusid()"><%#Eval("Name") %></a>
</span></li>
</ItemTemplate>
</asp:Repeater>
<!--网页右侧-->
<div class="guanyu-con">
<ul class="ul2">
<asp:Repeater ID="repNewContents" runat="server">
<ItemTemplate>
<li><a href="#"><%#Eval("Title") %></a><span><%# Convert.ToDateTime(Eval("AddDate")).ToString("yyyy-MM-dd")%></span></li>
</ItemTemplate>
</asp:Repeater>
</ul>
</div>
public void Content(string Nid)
{
this.repNewContents.DataSource = null;
repNewContents.DataSource = Business.B_News.getNewsData(Nid);
repNewContents.DataBind();
}
$(function meusid() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
}
xhr.open("POST", "这里不知如何写指定news.aspx.cs里面的Content方法,ID是前台的MID", true);
})
<script src="Scripts/new.js" type="text/javascript"></script>
<!--网页左侧-->
<asp:Repeater ID="RepMenus" runat="server">
<ItemTemplate>
<li><span>
<a href="#" id="MeusID" onclick="meusid('<%#Eval("ID"%>')"><%#Eval("Name") %></a><!----------->
</span></li>
</ItemTemplate>
</asp:Repeater>
<!--网页右侧-->
<div class="guanyu-con">
&