初学asp.net,做一个论坛,需要显示分层的结构,用了repeater的嵌套实现,但,子repeater的数据源绑定,有点不知道如何实现。在前台中,子repeater的DataSource='<%# ((datarowview)Container.DataItem)).Row.GetChildRows("myrelation")%>'>(c#)却提示了,datarowview是一个类型,不能用于表达式中,请问高手啊,在vb中,实现该功能的语句是什么呢?
还有,实现子repeater的数据绑定,有什么方式方法?参考过很多例子,但还不是很明白。

解决方案 »

  1.   

    you have an extra ) there, tryDataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("myrelation")%>'>(
      

  2.   

    DataSource='<%# ((datarowview)Container.DataItem).Row.GetChildRows("myrelation")%>'
    是这样子吗?
    还是提示了一样的错误
      

  3.   

    D:\example\example\dg.ascx(11) : error BC30684: “datarowview”是一个类型,不能用作表达式。 target.DataSource = CType(((datarowview)Container.DataItem).Row.GetChildRows("myrelation"),Object)
                                                            
    D:\example\example\dg.ascx(11) : error BC30198: 需要“)”。
     target.DataSource = CType(((datarowview)Container.DataItem).Row.GetChildRows("myrelation"),Object)这是编译器输出的详细情况。
      

  4.   

    应该没问题啊!!转换类型datarowview的时候注意大小写,
    DataRowView(试一下这个)!GOODLUCK!