Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Handling Data Binding Events with DataGrid problem


Message #1 by "Henri" <hvonfranquemont@m...> on Tue, 15 Jan 2002 15:03:42
Hello,
I am trying to use the data binding example from 'Professional ASP.NET' 
pages 323-325, but have substituted the DataList for a DataGrid. What I 
want is to display a different <img> depending on a 'Status' field in my 
datarow.
I just cannot get the example to work for either DataList or DataGrid and 
receive an error from the debugger that reads: 

System.InvalidCastException: Exception of type System.InvalidCastException 
was thrown.

, at the following line:

Dim objRowVals As DataRowView = CType(objArgs.Item.DataItem, DataRowView)

, which is a line from the book example. Can anyone tell me what I am 
doing wrong and is there an easier way to handle data binding events?
Thx,
Henri

  Return to Index