Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.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 - Fatal编程技术网

C# 由两个表绑定的中继器

C# 由两个表绑定的中继器,c#,asp.net,C#,Asp.net,我正在asp.net中从事一个项目。我使用了两个嵌套的中继器来显示状态和对该状态的注释。嵌套中继器绑定到具有两个表的数据源。现在,当我对第二个表的列的值求值时,它显示了一个not contain property name错误 如果将中继器与Datatable绑定,而不是与包含多个表的DataSet绑定,这会很好 首先分析是否要绑定 ds.表格[0] 或 ds.附表[1] 然后按如下方式绑定中继器 rep.DataSource = ds.Tables[0]; 或 根据您的选择谢谢,它成功了,

我正在asp.net中从事一个项目。我使用了两个嵌套的中继器来显示状态和对该状态的注释。嵌套中继器绑定到具有两个表的数据源。现在,当我对第二个表的列的值求值时,它显示了一个not contain property name错误


如果将中继器与Datatable绑定,而不是与包含多个表的DataSet绑定,这会很好

首先分析是否要绑定

ds.表格[0]

ds.附表[1]

然后按如下方式绑定中继器

rep.DataSource = ds.Tables[0];


根据您的选择

谢谢,它成功了,但出于好奇,如果我需要将repeater与两个表绑定,该怎么办
protected void rephomecontent_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
            HiddenField hf = e.Item.FindControl("hfstatusid") as HiddenField;

        if (hf != null)
        {
            Repeater rep = e.Item.FindControl("replike") as Repeater;

            if (rep != null)
            {


                int statusid = int.Parse(hf.Value.ToString());
                DataSet ds = new StatusLikeInfoAction().ViewStatusLike(statusid);
                rep.DataSource = ds;
                rep.DataBind();
             }
          }
        }
       }
rep.DataSource = ds.Tables[0];
rep.DataSource = ds.Tables[1];