ajax二级联动问题,二级没有显示
我用ajaxpro实现二级联动,浏览后二级没有显示
.aspx代码 :
<%@ Import Namespace="mynamespace" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Admin_AddJpkc.aspx.cs" Inherits="mynamespace.Admin_Admin_AddJpkc" %>
<%@ Register Assembly="DotNetTextBox" Namespace="DotNetTextBox" TagPrefix="DNTB" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>添加内容</title>
<SCRIPT language="javascript" type="text/javascript">
function class2Result()
{
var class2=document.getElementById("DDL_Class1");
Class2.GetAllClass2(class2.value,get_class2_Result_CallBack);
}
function get_class2_Result_CallBack(response)
{
if (response.value != null)
{
//debugger;
document.all("DDL_Class2").length=0;
var ds = response.value;
if(ds != null && typeof(ds) == "object" && ds.Tables != null)
{
for(var i=0; i<ds.Tables[0].Rows.length; i++)
{
var name=ds.Tables[0].Rows[i].classname;
var id=ds.Tables[0].Rows[i].classid;
document.all("DDL_Class2").options.add(new Option(name,id));
}
}
}
return
}
</SCRIPT>
</head>
<body>
<form id="form1" runat="server">
<div><br />
<table class="tableBorder" cellspacing="1" cellpadding="3" align="center" border="0">
<tbody>
<tr>
<th class="tableHeaderText" height="25">
添加内容 </th>
</tr>
</tbody>
<tbody>
<tr>
<td height="23" class="forumRow"><table width="100%" border="0" cellpadding="0" cellspacing="5">
<tr>
<td width="19%"><div align="right">标题:</div></td>
<td width="81%"><asp:TextBox ID="TxtTitle" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtTitle"
ErrorMessage="请填写标题"></asp:RequiredFieldValidator></td>
</tr>
</table></td>
</tr>
<tr>
<td height="23" class="forumRow"><table width="100%" border="0" cellpadding="0" cellspacing="5">
<tr>
<td width="19%"><div align="right">
类别:</div></td>
<td width="81%"><span style="width: 421px"> <asp:DropDownList ID="DDL_Class1" runat="server" >
</asp:DropDownList>
<asp:DropDownList ID="DDL_Class2" runat="server">
</asp:DropDownList></span></td>
</tr>
</table></td>
</tr>
<tr>
<td height="23" class="forumRow"><table width="100%" border="0" cellpadding="0" cellspacing="5">
<tr>
<td width="19%"><div align="right">内容:</div></td>
<td width="81%">
<DNTB:WebEditor ID="WebEditor1" runat="server" />
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="23" align="center" class="forumRow"><asp:Button ID="BtnSubmit" runat="server" Text="提交" />
<input type="reset" name="Submit" value="重置" /></td>
</tr>
</tbody>
</table>
</div>
</form>
</body>
</html>
.cs代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using mynamespace;
namespace mynamespace
{
public partial class Admin_Admin_AddJpkc : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(Admin_Admin_AddJpkc));
if (!Page.IsPostBack)
{
BindClass1();
}
}
public void BindClass1()
{
DDL_Class1.DataSource = Class1.GetAllClass1();
DDL_Class1.DataTextField = "classname";
DDL_Class1.DataValueField = "classid";
DDL_Class1.DataBind();
ListItem ClassDefault = new ListItem("请选择类别", "0");
DDL_Class1.Items.Insert(0, ClassDefault);
DDL_Class1.Items[0].Selected = true;
this.DDL_Class1.Attributes.Add("onchange", "class2Result();");
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
其中Class1,Class2是我写的类,浏览时,页面左下角的完成出现黄色!,双击进去,里面写.aspx的Class2未定义,但我已经加了那个类的命名空间,怎么不行呢?
请高手帮帮忙,谢谢!!!