62,243
社区成员




<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="sxzafcyy.WebForm3" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<script src="js/jquery.min.js" type="text/jscript"></script>
<script type="text/javascript">
function aa(ids) {
//这里写要提交到哪里,
//拼接一个url
var url = "WebForm3.aspx?id=" + ids
//
$.ajax({
type: 'get', //设置提交方式
url: url, //提交地址,
data: {},
cache: false, //异步提交
dataType: 'json',
dataType: 'html',
//设定返回的数据类型
//提交完成后执行的函数
success: function (data) {
//data 是后台返回的值
document.getElementById(<%#Eval("navigation_id")%>).innerHTML += data;
//这个值如何获取,js获取不到
}
});
}
</script>
<body>
<form id="form1" runat="server">
<div>
<p onmouseover="aa('a')">
<asp:Repeater ID="index_one" runat="server">
<ItemTemplate>
<%#Eval("navigation") %>
</ItemTemplate>
</asp:Repeater>
</p>
<p>
<asp:Repeater ID="index_two" runat="server">
<ItemTemplate>
<p id='<%#Eval("navigation_id")%>'><%#Eval("navigation_Name") %></p>
</ItemTemplate>
</asp:Repeater>
</p>
</div>
</form>
</body>
</html>
public partial class WebForm3 : System.Web.UI.Page
{
DB db = new DB();
public int id;
protected void Page_Load(object sender, EventArgs e)
{
index_on();
index_tw();
}
//一级导航栏
//navigation 名字
public void index_on()
{
string sql = "select id,navigation from navigation";
DataTable dt = db.reDt(sql);
index_one.DataSource = dt;
index_one.DataBind();
}
//二级导航栏
//navigation_Name 名字
//navigation_id 和一级 id 关联
public void index_tw()
{
id = string.IsNullOrEmpty(Request.QueryString["id"]) ? 0 : int.Parse(Request.QueryString["id"]);
string sql = "select navigation_id,id,navigation_Name from navigation_Name where id = "+id;
DataTable dts = db.reDt(sql);
index_two.DataSource = dts;
index_two.DataBind();
}