DataBinder.GetPropertyValue问题
DataBinder.GetPropertyValue(DataSource, property);其中DataSource是Post类
public class Post
{
.........
//类里面有个ARRAYLIST,包含了另外一个类Thread
public ArrayList ThreadList
{
get {return threadList;}
set {threadList= value;}
}
}
public class Thread
{
......................
public string ThreadName
{
get {return threadName;}
set {threadName= value;}
}
}
当用DataBinder.GetPropertyValue(DataSource, "ThreadName");//DataSource为类Post
提示错误,这里该怎么用呢?
--------------------编程问答-------------------- 要使用GetPropertyValue方法,必须实现接口,你的Post有实现吗?
看下GetPropertyValue参数的定义就可以了。 --------------------编程问答-------------------- <%#DataBinder.GetPropertyValue(Container.DataItem, "Model")%>
protected void Page_Load(object sender, EventArgs e)
{
ArrayList list= new ArrayList();
ProductList.Add(new Product("A", 99));
ProductList.Add(new Product("B", 159));
ListRepeater.DataSource =list;
ListRepeater.DataBind();
}
--------------------编程问答-------------------- <%#DataBinder.GetPropertyValue(Container.DataItem, "Model")%>
"Model"是指。。。。。。
补充:.NET技术 , C#