.NET三层架构中,表示层中的DetailsView控件,如何绑定BLL层传来的Students实体类的对象?
表示层中,有一个DetailsView控件,此页面的后台程序中:
protected void Page_Load(object sender, EventArgs e)
{
        if (Request.QueryString["code"] != null)
        {
            int code = int.Parse(Request.QueryString["code"].ToString());
            Students stu = StudentsBLL.GetStudentsByCode(code);
            this.DetailsView1.DataSource= stu;
            this.DetailsView1.DataBind();
        }
}
意思很简单,即:得到传来的 code的数值,调用StudentsBLL的GetStudentsByCode(code)方法,此方法传来一个Students对象,此Students对象包含name,age 等属性。现在需要在页面中,显示此Students对象的name,age 等属性。
但是,这样的绑定,有错误。
不知道,这样,该如何解决呢?
非常谢谢大家,不知道是否说明白了。