Change DataItem's in ListView on ItemDataBound Event

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

Change DataItem's in ListView on ItemDataBound Event

Postby 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/system.web.ui.webcontrols.listview.itemdatabound.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.
mabraham1
 
Posts: 6
Joined: Wed 21 Apr 2010 22:27

Postby 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?
Shalex
Devart Team
 
Posts: 7612
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for MySQL