How can solve this error to pass data to the view by ViewBag
?
An exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in System.Core.dll but was not handled in user code
Additional information: 'object' does not contain a definition for 'name'
In Controller
var linq = (from c in db.Catogeries
join a in db.Articals on c.Id equals a.CatogeryId
select new {name=c.Name,title=a.Title });
ViewBag.data = linq;
In View
@{
foreach (var item in ViewBag.data )
{
<p>@item.name</p>
}
}