Just use a rowNumber and a post increment :)
List<LinqToSlodgeRoutes.SlodgeRoutes_Activity> list = linqer.Collect(myUserId);
ListBoxItems.DataTextField = "Text";
ListBoxItems.DataValueField = "Value";
int rowNumber = 0;
ListBoxItems.DataSource = (from x in list
select new
{
Value = rowNumber++,
Text = string.Format("{2:dd MMM yy} - {2:HH:mm} - {0} - {1} - {3:N2} km", x.Type, x.SubType, x.StartTime, (x.DistanceMetres / 1000.0))
}).Reverse();
This does not work:
ReplyDeleteExpression tree cannot have an assignment operator.