可能是我的问题很简单,或者我对此并不陌生,问题是在尝试在中继器的项目数据绑定中执行以下代码时,我遇到了错误无法转换 *System.Data.Entity.DynamicProxies 类型的对象。 AutoPublishLog_06BC2AA20C3D11E56D78DD544C2C7E5211D828344650C93B9AA23BDEE16A6DCE' 输入“System.Data.DataRowView”。*
错误线是
Dim row As System.Data.DataRowView = DirectCast(e.Item.DataItem, System.Data.DataRowView)
任何帮助,在此先感谢
代码片段
Protected Sub AutoPublishList_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles AutoPublishList.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem OrElse e.Item.ItemType = ListItemType.Item Then
Try
Dim row As System.Data.DataRowView = DirectCast(e.Item.DataItem, System.Data.DataRowView)
Dim pageID As Literal = DirectCast(e.Item.FindControl("PageID"), Literal)
If Convert.ToInt32(row("PageID")) = Business.Objects.Constants.A Then
pageID.Text = "Dummy A"
End If
If Convert.ToInt32(row("PageID")) = Business.Objects.Constants.B Then
pageID.Text = "Dummy B"
End If
Catch ex As Exception
AddErrInfo(ex)
ErrHandler(ex)
End Try
End If
End Sub