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

  • Home
  • SEARCH
  • 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 7722821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:17:12+00:00 2026-06-01T04:17:12+00:00

I have a ContactModel like this: public class ContactModel { public virtual int ID

  • 0

I have a ContactModel like this:

public class ContactModel
{
    public virtual int ID { get; set; }
    public virtual string LastName { get; set; }
    public virtual ICollection<Note> Notes { get; set; }
}

The child collection Note is defined like this:

public class Note
{
    public virtual int ID { get; set; }
    public virtual ContactModel ContactModel { get; set; }     
    public virtual string NotesValue { get; set; }
}

I have added a controller that takes the ContactModel and creates Index,Edit, Create views for it.

e.g. I have modified the Index View for contact slightly to take a partial view:

@foreach (var item in Model) 
{
   @Html.Partial("_ContactView", item)

}

Inside the partial _ContactView I have this:

<span class="names"><a href="????">@Model.LastName</a></span>

And now here is where I am stuck, I would like to create an EditView for Note class and point to this view from the URL above. Which means when the user clicks on Lastname, it should open the editview for Notes in order to add additional notes for this person.

How do I achieve this?

  • 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-06-01T04:17:13+00:00Added an answer on June 1, 2026 at 4:17 am

    You can create a new controller dedicated to handling notes. Create the URL for it like so:

    <span class="names"><a href="@Html.Action("Edit", "Notes", new { ContactModelId = @Model.ID })">@Model.LastName</a></span>
    

    In the new NotesController, load up your collection of notes based on the ContactModel‘s ID being passed through the URL:

    public class NotesController : Controller {
        public ActionResult Edit(int contactModelId) {
            var result = Repository.ContactModel.Where(x => x.ContactModelId).Select(x => x.Notes);
            return View(result);
        }
    }
    

    Add code for adding/updating notes to the NotesController class as necessary.

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

Sidebar

Related Questions

Have you managed to get Aptana Studio debugging to work? I tried following this,
Have written all the code in a silverlight class library (dll) and linked this
In have a controller class that handle a Contact object. In this controller I
I am sorry if this has been posted before. I have searched many websites
I have an Address Model which has a ForeignKey to a Contact Model: class
I have had a couple of questions on this issue. However, now I have
Sorry if this has been addressed. I just can't get it to work. I
Please look at what I have done private InputSource getContent(String fName) throws SAXException, IOException,
Have a xml string, goal is to replace an xml element value to a
Have advancements in CPU design like dynamic instruction scheduling narrowed the performance gap between

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.