Change DataItem's in ListView on ItemDataBound Event

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply

Which ASP.NET Control Binds Best with DotConnect?

ListView
0
No votes
GridView
1
100%
FormView
0
No votes
DetailsView
0
No votes
Repeater
0
No votes
Standard Controls
0
No votes
3rd-Party Controls
0
No votes
 
Total votes: 1

mabraham1
Posts: 6
Joined: Wed 21 Apr 2010 22:27

Change DataItem's in ListView on ItemDataBound Event

Post by mabraham1 » Tue 27 Apr 2010 14:35

I'm trying to access a DataItem object during the ItemDataBound event in the 3.5 ListView control. I need to access the child object's properties. I'm using LINQ to retrieve the data.

Going by example, I'm unable to use the code the MS specifies here:
http://msdn.microsoft.com/en-us/library ... bound.aspx

The System.Data.DataRowView is not a valid cast, and I can't even get to the object doing something like this:
DataBinder.Eval(((System.Web.UI.WebControls.ListViewDataItem)e.Item), "Orderid")
OR this:
((System.Web.UI.WebControls.ListViewDataItem)e.Item).DataItem["Orderid"]

Please advise ASAP.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 29 Apr 2010 08:23

Could you please send us a small test project with the DDL/DML script to reproduce the issue in our environment?

Post Reply