Today, I 'd like to review the data of the current row in the ItemDataBound event without the need to bind a Repeater Layer 3. item. dataItem can also be used to directly return an object with three layers of time. For example, the time code for using List as the data source is ZM. zhao. model. channelInfo info = (ZM. zhao. model. channelInfo) e. item. dataItem, which can call the data of this object through attributes. However, when dataset is used, the conversion fails. The reason is as follows: The Rpeater bound to different types of data sources does not obtain the same type at the end ------
1. When you bind a data source with DataSet and DataTable
DataRowView view = (DataRowView) e. Item. DataItem;
2. When DataReader is bound to a data source
System. Data. Common. DbDataRecord view = (System. Data. Common. DbDataRecord) e. Item. DataItem;
3. When Using Generics as the data source, it is the type corresponding to generics.
For example, IList <DocumentInfo> is the data source.
DocumentInfo docInfo = (DocumentInfo) e. Item. DataItem;
Only the time for using List as the data source can be operated as before.