http://bbs.hidotnet.com/ShowPost.aspx?PostID=1554 
其中运行RelatedList演示代码时出现错误:
“/RelatedListDemo”应用程序中的服务器错误。
--------------------------------------------------------------------------------未找到列 [ParentValue]。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.EvaluateException: 未找到列 [ParentValue]。是怎么回事呀?高手们指点呀!不胜感激!

解决方案 »

  1.   

    很明显: 数据表中不存在 ParentValue列,检查你的数据库
      

  2.   

    我访问的是sqlserver自带的数据库呀
      

  3.   

    把你的数据库连接和T-SQL语句帖出来,让我们look一下
      

  4.   

    .在northwind数据库新建一张表category,建表的sql语句在category.sql文件里,演示数据在category.text文件里,做过无限级树型菜单的朋友应该不会陌生。2.修改index.aspx.cs文件中BindRelatedList2()方法中的数据库连接字符串的用户名和密码。没有装sqlserver数据库的朋友需要删除RelatedList2控件和BindRelatedList2()方法
      

  5.   

    我用的是一个下载的控件呀,地址是:http://bbs.hidotnet.com/ShowPost.aspx?PostID=1554 
    里面的RelatedList演示代码
      下面是全部的已知的源码:
      using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;namespace RelatedListDemo
    {
    /// <summary>
    /// Index 的摘要说明。
    /// </summary>
    public class Index : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.DropDownList DropDownList1;
    protected System.Web.UI.WebControls.DropDownList DropDownList2;
    protected System.Web.UI.WebControls.DropDownList DropDownList3;
    protected System.Web.UI.WebControls.DropDownList DropDownList5;
    protected System.Web.UI.WebControls.DropDownList DropDownList6;
    protected System.Web.UI.WebControls.DropDownList DropDownList7;
    protected System.Web.UI.WebControls.Button Button1;
    protected Ydyd.WebControls.RelatedList.RelatedList RelatedList1;
    protected Ydyd.WebControls.RelatedList.RelatedList RelatedList2;
    protected System.Web.UI.WebControls.DropDownList DropDownList4;

    private void Page_Load(object sender, System.EventArgs e)
    {
    if (!Page.IsPostBack)
    {
    ArrayList a = new ArrayList();
    a.Add("DropDownList1");
    a.Add("DropDownList2");
    a.Add("DropDownList3");
    a.Add("DropDownList4");
    RelatedList1.DataSource = @"ArticleCategory.xml";
    RelatedList1.ListID = a;
    RelatedList1.DataBind(); BindRelatedList2();
    }
    } private void BindRelatedList2()
    {
    //数据库连接字符串,请修改用户名和密码
    string con = "data source=localhost; initial catalog=northwind; user id=sa; password=aaa;";
    SqlConnection connection = new SqlConnection(con);
    SqlDataAdapter da = new SqlDataAdapter("select * from categories", connection);
    DataSet ds = new DataSet();
    da.Fill(ds); ArrayList b = new ArrayList();
    b.Add("DropDownList5");
    b.Add("DropDownList6");
    b.Add("DropDownList7");
    RelatedList2.DataSource = ds;
    RelatedList2.ListID = b;
    RelatedList2.DataBind();
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Button1.Click += new System.EventHandler(this.Button1_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void Button1_Click(object sender, System.EventArgs e)
    {
    Response.Write(DropDownList1.SelectedItem.Value + "|" + DropDownList1.SelectedItem.Text + "<br>");
    Response.Write(DropDownList2.SelectedItem.Value + "|" + DropDownList2.SelectedItem.Text + "<br>");
    Response.Write(DropDownList3.SelectedItem.Value + "|" + DropDownList3.SelectedItem.Text + "<br>");
    Response.Write(DropDownList4.SelectedItem.Value + "|" + DropDownList4.SelectedItem.Text + "<br>");
    Response.Write(DropDownList5.SelectedItem.Value + "|" + DropDownList5.SelectedItem.Text + "<br>");
    Response.Write(DropDownList6.SelectedItem.Value + "|" + DropDownList6.SelectedItem.Text + "<br>");
    Response.Write(DropDownList7.SelectedItem.Value + "|" + DropDownList7.SelectedItem.Text + "<br>"); }
    }
    }
      

  6.   

    asp.net做联动更方便了,可以不用写javascript了
      

  7.   

    net_lover(孟子E章)老大:
       用asp.net怎么做联动呀?我正为这个烦恼了好几天了呀!还请孟子老大指点一下呀!
      

  8.   

    你有没有看压缩包里的说明文件啊?叫你在northwind里再建一个表。不能急咯
      

  9.   

    多谢 nickycheng(枪枪成)!
      还真的没看,我是急糊涂了吧!