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