Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5963259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:13:24+00:00 2026-05-22T19:13:24+00:00

I need to display a list of comments within a view. I have created

  • 0

I need to display a list of comments within a view. I have created an editor template for the Viewmodel type of my Comments. I call:

@Html.EditorFor(x => x.Comments)

To loop through and render the indiviudal comments.

Now, I also need to add a comment to the list. After adding to the DB i need to use jQuery to append the new comment view to the current list.

Should I create another partial view to mirror the EditorTemplate view…Or just call Html.RenderPartial on the new view within the editor template in the first place?

Hope that makes sense..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:13:25+00:00Added an answer on May 22, 2026 at 7:13 pm

    Each view (be it a partial or not) has its own html helper Property. Using this property You can and call partial views to arbitrary depth. In your Situation i would suggest creating Display Template for comments because you are displaying them not editing them. it will create no difference in terms of functionality whatsoever but it violates the convention. For example this is your display template for comments accepting IEnumerable

    <%foreach(var x in Model){%>
    
    <div> @x.CommentText</div>
    
    <%} %>
    

    Then you can have a partial view rendering the form to add new comment which you can place in another partial view called comment accepting Model of type Comment e.g

    <%Html.BeginForm();%>
    <div><%:Html.HiddenFor(x=>x.CommentID)%>
    <%:Html.LabelFor(x=>x.CommentText)%>
    </div>
    <div>
    <%:Html.TextAreaFor(x=>x.CommentText)%>
    <input type='submit' value='save'/>
    <%:Html.Endform();%>
    

    i would personally call this view (rendering the form) from main view (from which i called Html.DisplayFor(x=>x.Comments)) because it is a concern separate from displaying list of comments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display a list of dates, which I have in a table
I have a view that displays a list of comments. Now a comment can
I have a SSRS local report and I need to display a list of
I need to display the list of names which I am getting from the
I need to display a single list, ordered by date which contains different types
i am developing one application with map view i need display the weather depends
I need to display all the employees in one webpart. I created the gridview
I need to display a multiply sign (×) in a modal being created by
I need to display list of news items from a database on a web
i need to display the list one by one in the same line. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.