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 500063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:02:57+00:00 2026-05-13T06:02:57+00:00

In my MVC application I have a problem with passing data from view to

  • 0

In my MVC application I have a problem with passing data from view to controller. I have fairly complex domain classes:

public class TaskBase : PersistableObject
{
    public virtual TaskCategory Category { get; set; }
    public virtual IList<TaskNote> Notes { get; set; }
    public virtual string TaskTitle { get; set; }
    public virtual string TaskBody { get; set; }
    public virtual DateTime? CreationTime { get; set; }
    public virtual User CreatedBy { get; set; }
    public virtual int CompletionRatio { get; set; }
}

public class MainTask : TaskBase
{
    public virtual IList<TaskBase> ChildTasks { get; set; }
    public virtual User AssignedTo { get; set; }
    public virtual IList<TaskHistory> History { get; set; }
}

public class TaskFormModel : ViewDomainBase
{
    public MainTask Task { get; set; }
    public LoginForm LoginInfo { get; set; }
}

And in my view I want to pass an instance of TaskFormModel to the controller.

<%= Html.ActionLink<TaskController>("Edit Task", (x) => x.Edit(new TaskFormModel() { Task = item, LoginInfo = Model.LoginInfo }))%>

And here is the controller action:

public ActionResult Edit (TaskFormModel taskInfo)
{
    return View(ViewPageName.TaskDetailsForm, task.Task);
}

In this action method taskInfo comes null even if I pass non-null instance from view. I think I have a binding problem here. I think, writing custom model binder requires every property to be converted and also when new fields added then binder class should also be changed, so I don’t want custom model binder to do this. Is there any other way to pass data to controller in this scenario? Or could custom model binder can be coded so that less code written and also when new properies are added binder class will not need to be changed?

Edit After Comments: What I am trying to achieve is basically to pass an instance from one view to another view, without querying repository/db in my controller’s action.

  • 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-13T06:02:57+00:00Added an answer on May 13, 2026 at 6:02 am

    First version of answer:

    Your GET edit method should be like:

    public ActionResult Edit (int id)
    {
        var model = taskRepository.GetTaskEditModel(id);
        return View(ViewPageName.TaskDetailsForm, model);
    }
    

    and ActionLink:

    <%= Html.ActionLink("Edit Task", "Edit", "Task", new { model.Task.id })%>
    

    If you want to pass complex objects to controller, you should wrap them up in html form and pass to POST action.

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

Sidebar

Ask A Question

Stats

  • Questions 266k
  • Answers 266k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer OK, Through help on the Idea forums, much googling, and… May 13, 2026 at 12:42 pm
  • Editorial Team
    Editorial Team added an answer Yes - you need to do double-buffering to prevent the… May 13, 2026 at 12:42 pm
  • Editorial Team
    Editorial Team added an answer If path is a relative path, then it should work,… May 13, 2026 at 12:42 pm

Related Questions

I am using the Redirect After Post pattern in my ASP.NET MVC application. I
I'm new to the world of IoC and having a problem with implementing it
Greetings, Trying to sort through the best way to provide access to my Entity
I've been benchmarking the performance of a framework I'm writing in Perl and I'm
In my MVC application I have a folder full of PDF documents users should

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.