0

我创建了一个 Web 应用程序,并创建了一个页面来显示与 Facebook 相同的帖子,但我的评论框在 asp.net 中不起作用。

[WebMethod]
public static string LoadImages( int Skip, int Take ) {
    // string image;
    System.Threading.Thread.Sleep( 2000 );
    StringBuilder GetImages = new StringBuilder();
    // string Imagespath = HttpContext.Current.Server.MapPath("~/networking/image/");
    // string SitePath = HttpContext.Current.Server.MapPath("~/networking");
    //var Files = (from file in Directory.GetFiles(Imagespath) select new { image = file.Replace(SitePath, "") }).Skip(Skip).Take(Take);
    int records = 0;
    var Files = ProductDataManager.GetRequiredPost( 1, 100, ref records ).Skip( Skip ).Take( Take );


    foreach( var file in Files ) {
        string postimage = null;
        if( file.PostImage != "" ) {
            postimage = file.PostImage.Replace( "\\", "/" ).Substring( 13 );
        }
        string image = null;
        if( file.PostImage != "" ) {
            image = file.ImageUrl.Replace( "\\", "/" ).Substring( 13 );
        }
        GetImages.AppendFormat( String.Format( @"                 
                            <div style='clear: both;'>
                                <div style='float: left;'>
                                    <img src='{0}' id='userimage1' height='50' width='50' runat='server'/>
                                </div>
                                <div style='float: left; margin-left: 8px; font-family: Arial; font-size: 14px; font-weight: bold;
                                    color: Navy;'>
                                    <span id='ctl00_ContentPlaceHolder1_gdvgrid_ctl06_username1'>{1}</span>
                                </div>
                                <div style='float: right;'>

                                </div>
                            </div>
                            <div style='margin-left: 70px; clear: both;'>
                                <div style='clear: both; color: Black; font-family: Arial; width: 400px;'>
                                    <span id='txtsub1' style='display:inline-block;width:400px;font-family: Arial; font-size: 15px; color: #64635d;'>{2}</span>
                                </div>
                                <div style='clear: both; font-family: Arial;'>
                                    <img src='{3}' width='400'/>
                                </div>
                                <div style='color: Black; width: 400px; text-align: justify'>
                                    <span style='font-family: Arial;
                                        font-size: 12px; color: #64635d; text-align: justify; line-height: 15px;'>{4}</span>
                                </div>

        <div style='float: left; margin-top: 10px; margin-right: 10px;'>
                <a onclick='$find(&#39;SendMail3&#39;).show();return false;' id='ctl00_ContentPlaceHolder1_gdvgrid_ctl{6}_btnsendenq' href='href='javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$gdvgrid$ctl{7}$btnsendenq&#39;,&#39;&#39;)' style='font-size: 12px; color: #6d84b4;' tabindex='-1'>Send Enquiry</a>
        </div>
        <div style='float: left; margin-top: 10px; margin-right: 10px;'>
            <a onclick='$find(&#39;Commentdialog&#39;).show();return false;' id='ctl00_ContentPlaceHolder1_gdvgrid_ctl{8}_btnsendenq' href='javascript:__doPostBack(&#39;ctl00$ContentPlaceHolder1$gdvgrid$ctl{9}$lnkcomment&#39;,&#39;&#39;)' style='font-size: 12px; color: #6d84b4;' tabindex='-1'>Comment</a>
                                </div>
<div style='display: none'>
            <input type='submit' name='ctl00$ContentPlaceHolder1$gdvgrid$ctl{10}$btncomment' value='Comment' id='ctl00_ContentPlaceHolder1_gdvgrid_ctl{11}_btncomment' style='width:100px;'>

</div>

<div style='clear: both; color: #c0c0c0; font-size: 12px; padding-top: 10px; font-weight: bold;'>
                                    <span id='ctl00_ContentPlaceHolder1_gdvgrid_ctl06_lbldate'>{5}</span>
                                </div>
                            </div>

                            <div style='border-bottom: 2px solid gray; padding-bottom: 10px;'>
                            </div>

                            ", image, file.CompanyIdentity, file.PostTitle, postimage, file.PostDescription, file.CreateDate, file.Userid, file.Userid, file.ScrapID, file.ScrapID, file.ScrapID, file.ScrapID ) );
    }
    return GetImages.ToString();
}
4

2 回答 2

0

You can integrate facebook comment box instead of implement your own.

Facebook Comments Box: Comments Box is a social plugin that enables user commenting on your site. Features include moderation tools and distribution.

于 2013-04-05T08:34:37.160 回答
0

您可以使用 asp.net 转发器来显示评论并使用 SQL 来存储评论。算法 -> 获取名称和注释 ->> 在 sql 数据库表中插入数据 ->> 将数据绑定到 asp.net 转发器。如何使用 asp 中继器:http ://www.w3schools.com/aspnet/aspnet_repeater.asp 对于 facebook 样式,使用 css。

于 2013-06-01T10:45:31.490 回答