开发者

What's the best way to implement threaded conversations like the Facebook Wall in .NET?

开发者 https://www.devze.com 2023-01-03 09:41 出处:网络
I\'m just wondering what\'s the best way to implement a threaded conversation like the Facebook Wall where the comments are displayed under each post, and older comments are collapsed and expandable.M

I'm just wondering what's the best way to implement a threaded conversation like the Facebook Wall where the comments are displayed under each post, and older comments are collapsed and expandable. My instinct is to use a neste开发者_如何学Cd datalist, but I think that might take a toll on performance.


I would look into using ASP .NET MVC instead of webforms. I would load the first few posts server side with the initial page load and then look at implementing a client-side solution using AJAX with jQuery to retrieve additional records - there is an example of that here.


I'd use 2 DataLists.

DataListA would only show the top 5 comments, but underneath DataListA would be a LinkButton with the text "### more comments...". (This LinkButton would be hidden when there are a total of 5 or fewer comments)

When the user clicks on the LinkButton, DataListA is hidden and DataListB is shown.

DataListB shows all comments, not just the first 5.

The LinkButton, of course, would have its text change to "hide ### comments..." when DataListB is showing.

If you cache your dataset in the ASP.NET Cache Object, then it won't be a performance hit.

0

精彩评论

暂无评论...
验证码 换一张
取 消