Showing Comments on Blog Post Details

Autumn

New Member
Currently I have a partial view that displays comments from the database associated with a certain blogid. I can't get this to work for the life of me. I can't even figure out how to pass the blogid to the partial so I pull the correct comments. Here is what I have so far./Blog/Details Comment Portion\[code\]<h2>Comments</h2><hr/>@if (!User.Identity.IsAuthenticated){ <p>You Must Be Logged In To Comment.</p>} else{ @: Posting comments as @User.Identity.Name<hr/> @Html.Action("Create", "Comment", new {blogId = Model.Id}); @: <hr/>}@Html.Partial("_Comments")\[/code\]_Comments partial view\[code\]@model IEnumerable<GregG.Models.Comment>@foreach (var item in Model) { if (item.BlogId == 1) //I need to make this dynamic but can't figure out how to pass the id { <small>Posted by: @Html.DisplayFor(modelItem => item.UserName) on: @Html.DisplayFor(modelItem => item.PostedDate)</small> @Html.DisplayFor(modelItem => item.Meat)<hr/> }}\[/code\]My first question is: How do I pass my blog Id to the partial.My second question is why do I receive this error on my partial line.\[quote\] The model item passed into the dictionary is of type 'System.Data.Entity.DynamicProxies.Blog_18032B13AD6163845F0AE57E827683E3638FD813CA4EE066F28D05E5406E633D', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[GregG.Models.Comment]'.\[/quote\]Thanks in advance for any help.
 
Back
Top