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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:04:24+00:00 2026-06-14T14:04:24+00:00

I am trying to accomplish what I thought would be simple. I just cannot

  • 0

I am trying to accomplish what I thought would be simple. I just cannot wrap my mind around it.

I have a list of organizations, it is just the OrganizationID and Name. What I wanted to do was have an “add” link, much like an edit, that is next to each organization (just like the delete and edit buttons).

It would grab the OrganizationID and pass it to one of my Create Views in other controllers and automatically fill in just the field for OrganizationID.

The add link would simply point to a View that has a DropDownList. The user would then select one of the options, for example Address, to add an address to the Organization that was selected from the list of Organizations. After the user selects Address, they hit the submit button. Then it goes to the OrganizationAddress Create View and fills in the OrganizationID field automatically.

I really hope I explained it well enough.

This is the Add ActionResult in my OrganizationController

public ActionResult Add(int id)
{
    using (var db = new VAGTCEntities())
    {
        ViewBag.OrgPages = ddp.PageList();
        return View(db.Organizations.Find(id));
    }
}

Grabs the Organization.

Here is the form in my Add view:

    <fieldset>
        <legend>Organization</legend>

        @Html.HiddenFor(model => model.OrganizationID)

        <div class="editor-label">
            @Html.Label("Add:")
        </div>
        <div>
            @Html.DropDownList("OrgPages")
        </div>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

Here is the Add POST ActionResult in my OrganizationController

[HttpPost]
public ActionResult Add(int id, Organization organization, int OrgPages)
{

    try{
        ViewBag.OrgID = id;
        if (OrgPages == 2)
            return RedirectToAction("Create", "OrgAddress");
        else if (OrgPages == 3)
            return RedirectToAction("Create", "OrgIE");
        else if (OrgPages == 4)
            return RedirectToAction("Create", "OrgMembership");
        else if (OrgPages == 5)
            return RedirectToAction("Create", "OrgBusinessType");
        else if (OrgPages == 6)
            return RedirectToAction("Create", "OrgIndustryType");
        else if (OrgPages == 7)
            return RedirectToAction("Create", "OrgPhone");
        else if (OrgPages == 8)
            return RedirectToAction("Create", "OrgEmail");
        else if (OrgPages == 9)
            return RedirectToAction("Create", "OrgWebsite");
        else if (OrgPages == 9)
            return RedirectToAction("Create", "OrgNote");
        else                   
            return RedirectToAction("Index");
    }
    catch (Exception)
    {
        ModelState.AddModelError("Error", "This item exists in the database already.");
        ViewBag.OrgPages = ddp.PageList();
    }
    return View(organization);
}

From here I cannot figure it out. Anything I try to pass turns out null.
I am still new to MVC – slowly, slowly learning my way!

Thank you very much!

  • 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-14T14:04:26+00:00Added an answer on June 14, 2026 at 2:04 pm

    Do you have a custom route to account for the following parameters you are passing?

    public ActionResult Add(int id, Organization organization, int OrgPages)
    

    In your view, you can either specify what action the form will be posting to and include the parameters OR just add those properties (i.e. Organization, OrgPages) to the view model and then let MVC do all the binding for you.

    Read this for details

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

Sidebar

Related Questions

I'm trying to accomplish a simple thing. I have a 2 levels menu with
Im trying to accomplish something which may seem a bit convoluted but would be
I'm trying to accomplish one simple task (but is not simple for me). I
Which I'm trying to accomplish is have two classes, a non generic and a
I'm trying to accomplish a simple task of creating a database with 2 tables
I am trying to hide my websites cms application... So i thought i would
I'm using the flag friend module, and I'm trying to accomplish what I thought
I am trying to wrap my head around this one this morning. I am
I'm trying to accomplish something very, very similar to the below picture with CSS3
I'm trying to accomplish this but I've got no clue about getting a GWT

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.