在Page_Load中动态添加一个控件,如下所示:dim Con as System.Web.UI.UserControl = Page.LoadControl("control.ascx")Con.Attributes.Add("test","ok")PlaceHolder1.Controls.add(con)上面第二行为这个控件添加了一个名为test的属性,但是这样只能添加字符串,如果现在属性是保存在一个数组或者结构里面的,有没有办法将这个数组或结构直接传递给控件?
调试欢乐多
You can bind several of the standard ASP.NET controls to a data source. For example, you can bind a Repeater control to data sources, such as DataReaders, ArrayLists, and DataViews.
You too can create a control that supports binding to a data source. To create a DataBound control, you must do the following:1> Add a DataSource property. This property typically implements the IEnumerable, ICollection, IList, or IListSource interface.
2> Add an OnDataBinding subroutine. This subroutine is invoked when the DataBind method is called.