Hi.
I have a big table and i want to show some filed using linq query.
List<DA.Tel> lst = PublicDA.Db.Tels.OrderBy(p => p.orderNumber).ToList()
Then I bind this query to my DataGridview.Now I When user click on grid I want to know which record is selected and doing some action .
I use CurrencyManager to control binding and find current record;
object source = selectQuery();
CurrencyManager cur = (CurrencyManager)this.BindingContext[source];
dg.DataSource = source;
So when i want to do some action to current record,for example if i select from
Tel table:
if (cur.Position > -1)
Tel entity= (Tel)cur.Current;
It work fine when we select from my one table,But mostly ,I want to select a few field,or select from two table,
var query = from d in PublicDA.Db.Tels
where d.TelActionID == actID
orderby d.RegisterDate descending
select new
{
d.FirstName,
d.LastName,
d.TelNumber,
d.Mobile,
d.Address,
d.Dsc,
d.id,
d.EnteryDate,
d.RegisterDate
};
In this case because the linq query type is AnonymousType I have Problem to cast it.
I use this method in so many form and I want to find a good solution?
Any idea.