asp.net - Unable to cast object of type 'System.Collections.Generic.List -
i getting error
unable cast object of type 'system.collections.generic.list`1[transtripleg]' type 'system.data.datatable'.
and can't seem figure out how resolve it. error occurs @ datatable dttable =
in code below.
if (!string.isnullorempty(request.querystring["editmode"])) { datatable dtupdate = (datatable)session["triprecords"]; datarow[] customerrow = dtupdate.select("legid = '" + slegid.tostring() + "'");
i think casting type datatable, still error.
you need cast session["triprecords"]
list<transtripleg>
instead of datatable
var collection = (list<transtripleg>)session["triprecords"]; var legs = collection.where(c => c.legid == slegid);
Comments
Post a Comment