ListView中的“注释"列 [英] Comments Column in a ListView

查看:80
本文介绍了ListView中的“注释"列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个绑定到表的Listview DataControl,我还有一个称为COMMENTs的从属表,它可以作为单个列附加到主listview,但是对于第一个(main)的单个记录将有多个记录(评论) )表,我该如何实现?

非常感谢,
Chetan.


I have a Listview DataControl which i am binding to a table, I have another dependent Table called COMMENTs which i what to attach as a single column to the main listview but will have multiple records(comments) for a single record from the first(main) table, how do i achieve this?

Thanks very much,
Chetan.

推荐答案

您必须将Repeater控件放入Main listView cotrol中.然后您需要为
添加代码
You have to put Repeater control inside the Main listView cotrol. And then you need to add code for
listview_rowdataboud(..)
{
//   you have to find repeater control herr...
    Repeater repcomment = e.row.findcontrol("your repeater control id");
    repcommnet.DataSource = getComment(id)
    repcommnet.DataBind();
}

getComment(int id)
{
    //here is the logic to get comments from database and return datatable
    return dt;
}


注意:这是代码段,它与此相关,您必须为此编写适当的代码.

谢谢,
Imdadhusen


Note: this is code snippet, it something link this, you have to write proper code for the same.

Thanks,
Imdadhusen


这篇关于ListView中的“注释"列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆