我有一些像rpA,rpB等id到'rpZ'的id中继器控件。我想要做的是我想在后面的代码中找到asp中继器,并相应地绑定一个数据源..到目前为止我编写的代码是在下面,其中'我'是一个整数,范围从65到90.并且'tb'是一个DataTable。如何找到asp转发器控件并将数据绑定到它
string lblName = "lbl" + Convert.ToChar(i);
string repName = "rp" + Convert.ToChar(i);
FindControl(lblName).Visible = true;
FindControl(repName).Visible = true;
IDataBoundControl repID = FindControl(repName) as IDataBoundControl;
ITextControl lblID = FindControl(lblName) as ITextControl;
lblID.Text = (Convert.ToChar(i)).ToString();
repID.DataSource = tb;
repID.DataBind();
,但我不能够进行数据绑定()。最后一行如果你给了一个错误“System.Web.UI.WebControls.IDataBoundControl不包含的DataBind的定义”
什么错误? “tb”的价值是什么? – millimoose 2013-02-13 10:27:25
请参阅我的编辑.. – Niar 2013-02-13 10:31:05