asp.net中的评论树 [英] Comment Tree in asp.net

查看:59
本文介绍了asp.net中的评论树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个基于评论的项目,其中用户发表评论和其他人可以回复他/她的评论。

我想以嵌套的形式显示评论。例如:



1)评论A

2)回复评论no 1

3)回复tocomment no。 2





4)回复评论no 1

5)回复tocomment no。 5



就像明智一样。



我有一个数据库tablble tbl_comment有列



CommentID,CommentText,日期,时间,ParentID



其中parentID是回复的commentID。

我在检索注释的树视图时遇到问题

解决方案





您正在以分层方式检索数据。

如果您正在使用任何ORM,如实体框架,那将很容易,因为它将在内部为您生成所有查询。

如果您正在使用ADO.net,您必须创建一个存储过程来检索单个表中的所有数据,并且您可以根据父ID在树视图中转换它们。易于使用的解决方案是List< t>。树视图。



谢谢,


我找到了解决方案

Here

I am building a comment based project, in which the user post comments and other can reply his/her comments.
I want to show the comments in nested form.For example:

1)Comment A
2)Reply TO Comment no 1
3)Reply tocomment no. 2


4)Reply to comment no 1
5) Reply tocomment no. 5

like wise.

I have a database tablble tbl_comment having columns

CommentID, CommentText, Date, time, ParentID

where parentID is the commentID for which the reply is made.
I having trouble in retrieving the tree view of comments

解决方案

Hi,

You are retrieving data in hierarchical way.
If you are using any ORM like Entity Framework than it would be easy as it will generate all queries for you internally.
If you are using ADO.net and you have to create a stored procedure to retrieve all data in a single table and you can convert them in tree view based on parent id. Easy solution to use is List<t> for tree view.

Thanks,


I Found the solution
Here


这篇关于asp.net中的评论树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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