Reputation: 540
I have some asp repeater control with id like 'rpA','rpB' and so on upto 'rpZ'. What i want to do is i want to find the asp repeater in code behind and bind a datasource accordingly..the code so far i have written is is below,where 'i' is an int and it ranges from 65 to 90.And 'tb' is a DataTable.
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();
But i'm not able to to DataBind().The last line is giving an error"System.Web.UI.WebControls.IDataBoundControl does not contain a definition of DataBind"
Upvotes: 0
Views: 319