title: Unable to cast object of type 'System.Data.Entity.DynamicProxies to type 'System.Data.DataRowCollection'
body: <p>May be my question is simple or i am new to this ,the thing is While trying to do the below code in the item data bound of a repeater im gettin  the error Unable to cast object of type
   *System.Data.Entity.DynamicProxies.AutoPublishLog_06BC2AA20C3D11E56D78DD544C2C7E5211D828344650C93B9AA23BDEE16A6DCE' to type 'System.Data.DataRowView''.*</p>
  
  <p>Error Line is </p>
  
  <pre><code>Dim row As System.Data.DataRowView = DirectCast(e.Item.DataItem,   System.Data.DataRowView)
  </code></pre>
  
  <p>Any help ,Thanks in advance</p>
  
  <p>code snippet</p>
  
  <pre><code>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
  </code></pre>