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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:10:07+00:00 2026-05-24T20:10:07+00:00

its me… yet again! Ive got these class, public class PrankTargetArgumentViewModel { public PrankTarget

  • 0

its me… yet again!

Ive got these class,

 public class PrankTargetArgumentViewModel
{
    public PrankTarget Target { get; set; }
    public PrankDefinition Prank { get; set; }
    public List<PrankArgument> Arguments { get; set; }
}

public class PrankArgument
{
    public string Name { get; set; }
    public string Value { get; set; }
}

and what I’m doing is – if this current ParkDefinition needs arguments them im doing an ActionRedirect on the save to another Action which should handle the gathering of the Arguments

My Action result is like this..

    public ActionResult PrankArguments()
    {
        PrankInstance currentInstance = SessionContext.CurrentPrankInstance;

        if (currentInstance == null)
            throw new ArgumentNullException("currentInstance");

        PrankTargetArgumentViewModel model = new PrankTargetArgumentViewModel();
        model.Prank = currentInstance.Prank;
        model.Target = currentInstance.Target;

        string[] args = model.Prank.Arguments.Split('|');

        model.Arguments = new List<PrankArgument>();
        foreach (string s in args)
        {
            model.Arguments.Add(new PrankArgument { Name = s, Value = s });
        }

        return View(model);
    }

my http post method is just an empty method with the parameter of PrankTargetArgumentViewModel

    [HttpPost]
    public ActionResult PrankArguments(PrankTargetArgumentViewModel model)
    { 
        return View();
    }

My HTML is like this..

@using (Html.BeginForm())
{
@Html.EditorFor(x => Model)  

<p>
    <input type="submit" value="Create" />
</p>
}

So my problem is this, on the PrankArguments(PrankTargetArgumentViewModel model) post back action, the model param is always null.. I’ve filled the object with values on the load so I guessed they would be there on the post back with the new arguments that I added.

so the flow goes like this.

Create Prank
If prank needs arguments then load ActionResult PrankArguments()
Add extra arguments to an already poplulated object.
save, Call ActionResult PrankArguments(PrankTargetArgumentViewModel model)
— this is where the problem is, the model parameter is passed back as null.

Ive had this problem quite a few times and always just given up but im not going to let that happen this time!

any help would be great! cheers, Ste!

Ps. If you need anymore of my code just let me know.

EDIT – Removed view bag debug properties!

  • 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-24T20:10:07+00:00Added an answer on May 24, 2026 at 8:10 pm

    After reviewing my own code – I noticed that I didn’t need the entire PrankTargetArgumentViewModel and a simple List of Arguments would have been fine.

    I alterd my PrankArguments view to take an IEnumerable and used;

    @using (Html.BeginForm())
    {
    @Html.EditorForModel()
    
    <p>
        <input type="submit" value="Finish" />
    </p>
    }
    

    then had my post back method signature like this

     [HttpPost]
     public ActionResult PrankArguments(IEnumerable<PrankArgument> arguments)
    

    which worked exactly how I wanted.

    Thanks for all the suggestions guys.

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

Sidebar

Related Questions

its me again. I got my results to display from the bean list, but
Its a exercise that ask to indicate the class Big-Theta(g(n)) the functions belongs to
Its said that property should not be Set only (Code analysis rule CA1044 )and
Its been a while now and im still trying to get a certain code
Its pretty straightforward to get the first x lines of a text file, but
Its me again come up with another question, how to adjust padding between each
Its my first time asking here, i hope get help, and meanwhile, help you
its me again! :) I've been tasked with creating a system to auditing out
Its our old friend again..... I am recieving this error and i cant think
Its possible I am just really really thick. However, looking over the SDK for

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.