Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从页面加载填充时将不显示表_C#_Asp.net_Event Handling - Fatal编程技术网

C# 从页面加载填充时将不显示表

C# 从页面加载填充时将不显示表,c#,asp.net,event-handling,C#,Asp.net,Event Handling,我试图在page_load中填充一个表,但是没有显示任何内容,我知道我已经从数据库中得到了结果。这是我的密码: p 这是我的推荐方法: public void showRecommendations(string data) { Recommendations recommendList = new Recommendations(); List<string> similarUsers = new List<s

我试图在page_load中填充一个表,但是没有显示任何内容,我知道我已经从数据库中得到了结果。这是我的密码:

p

这是我的推荐方法:

public void showRecommendations(string data)
        {

            Recommendations recommendList = new Recommendations();
            List<string> similarUsers = new List<string>();
            List<RecommendedWebsites> recommendationList = new List<RecommendedWebsites>();


            recommendationList = recommendList.getRecommendations(data);


             TableRow trow ; 
            TableCell tcell;
            recommendedsites.Visible = true;
             foreach (RecommendedWebsites recommendation in recommendationList)
            {
                Label1.Text = recommendation.getTitle();
                 trow = new TableRow (); 

                    tcell= new TableCell (); 
                    tcell.Controls.Add(new LiteralControl("<b>" + recommendation.getTitle() + "</b>")); 
                    trow.Cells.Add(tcell);
                    tcell.Controls.Add(new LiteralControl("<p> <a href=\"" + recommendation.getLink() + "\"</a>" + recommendation.getLink() + "</p>"));
                    trow.Cells.Add(tcell);
            recommendedsites.Rows.Add(trow); 
            }

        }
public void showRecommensions(字符串数据)
{
建议列表=新建议();
List similarUsers=新列表();
列表建议列表=新列表();
recommendationList=recommendList.getRecommendations(数据);
TableRow-trow;
表细胞;
推荐站点。可见=真;
foreach(推荐列表中的推荐网站推荐)
{
Label1.Text=Recommension.getTitle();
trow=新表行();
tcell=新的TableCell();
添加(新的LiteralControl(“+Recommension.getTitle()+”);
trow.Cells.Add(tcell);

tcell.Controls.Add(建议使用新的LiteralControl()作为asp.net数据控件(gridview或类似的东西),如果是,您可能需要添加recommendedsites.DataBind()

您的代码中推荐的站点是什么?在Pageinit中这样做怎么样?它只是一个简单的asp表控件:
,我将它填充到c中code确定它现在起作用了:)我收到了http请求,这影响了输出
public void showRecommendations(string data)
        {

            Recommendations recommendList = new Recommendations();
            List<string> similarUsers = new List<string>();
            List<RecommendedWebsites> recommendationList = new List<RecommendedWebsites>();


            recommendationList = recommendList.getRecommendations(data);


             TableRow trow ; 
            TableCell tcell;
            recommendedsites.Visible = true;
             foreach (RecommendedWebsites recommendation in recommendationList)
            {
                Label1.Text = recommendation.getTitle();
                 trow = new TableRow (); 

                    tcell= new TableCell (); 
                    tcell.Controls.Add(new LiteralControl("<b>" + recommendation.getTitle() + "</b>")); 
                    trow.Cells.Add(tcell);
                    tcell.Controls.Add(new LiteralControl("<p> <a href=\"" + recommendation.getLink() + "\"</a>" + recommendation.getLink() + "</p>"));
                    trow.Cells.Add(tcell);
            recommendedsites.Rows.Add(trow); 
            }

        }