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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:46:13+00:00 2026-05-23T00:46:13+00:00

I have a controller with 2 Index methods: public ActionResult Index() { viewModel.PipelineIndex pivm

  • 0

I have a controller with 2 Index methods:

public ActionResult Index()
{
    viewModel.PipelineIndex pivm = new viewModel.PipelineIndex(null, User.Identity.Name);
    return View(pivm);
}

[HttpPost]
public ActionResult Index(viewModel.PipelineIndex model, FormCollection collection)
{
    viewModel.PipelineIndex pivm = null;
    if (ModelState.IsValid)
    {
        string key = collection.AllKeys[0];
        string ID = collection.Get(key).ToString();
        pivm = new viewModel.PipelineIndex(ID, User.Identity.Name);
    }
    else
        pivm = new viewModel.PipelineIndex(null, User.Identity.Name);

    return View(pivm);

}

The ViewModel I am using is a well defined class:

public class PipelineIndex
{
    private Models.Context _db = new Models.Context();

    public List<SelectListItem> GroupList { get; set; }
    public List<string> ButtonCaptions { get; set; }
    public List<ContactDetail> ContactList { get; set; }
    public string PageTitle { get; set; }
    ...

The View consumes the ViewModel setting up a Grid and a Drop Down control:

@model BlueSkies.Pipeline.ViewModels.PipelineIndex
@{ ViewBag.Title = "Index"; }
@using (Html.BeginForm()) 
{
    <h2>@Model.PageTitle</h2>
    <div style="clear:both">
        @if (Model != null)
        {
            var grid = new WebGrid(canPage: true, rowsPerPage: 15, canSort: true, ajaxUpdateContainerId: "grid");
            grid.Bind(Model.ContactList, rowCount: Model.ContactList.Count, autoSortAndPage: true);
            grid.Pager(WebGridPagerModes.All);
            @grid.GetHtml(htmlAttributes: new { id = "grid" },
            columns: grid.Columns(
                grid.Column(format: (item) => Html.ActionLink("View", "Details", "Contacts", new { ID = item.Name }, null)),
                grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", "Contacts", new { ID = item.Name }, null)),
                grid.Column("Name"),
                grid.Column(columnName: "Phone1", header: "Phone")
            ));
        }
    </div>
    <hr />
    <div>
        @*foreach (string caption in ViewBag.ButtonCaptions)
        { 
            @Html.ActionLink(caption, "Index", "Pipeline", new { ID = caption }, new { @class = "menuSubButton" })
        }*@
        @Html.DropDownList("GroupDropDown", Model.GroupList, new { @onchange = "this.form.submit()" }) &nbsp; Select a pipe section...
    </div>
}

Where I am having challenges is when the Drop Down fires the Form.Submit (on the onChange event). No model is being returned to my Controller. I do have the FormCollection but I would rather have the updated model including the new selectedItem in the drop down. What am I missing? And yes, I am looking for a non-JS based solution at this point – or as close as I can. I don’t want to AJAX this page.

TIA

NOTE: There is a similar question here. It is AJAX based but getting the same null model on call into the controller. Why is it so hard to find the right answer? 🙂

  • 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-23T00:46:14+00:00Added an answer on May 23, 2026 at 12:46 am

    I think the rendered HTML form will have a select with the name “GroupDropDown”, is that right? If so, the selected value will be posted back on submit with that name and would be bound to either a parameter called groupDropDown or to a string property GroupDropDown on your model class. Do you have such a property on your model?

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

Sidebar

Related Questions

I have 2 Action methods in one controller, Index: public ActionResult Index(string url) {
I have this controller method: public ActionResult Index(string searchError) { // get all errors
I have a controller method that looks like this: [AcceptGet] public ActionResult Index(SecurityMatrixIndexViewModel model)
i have this controller: public ActionResult Novo() { var products = context.Product.Select(x => new
On ASP.NET MVC 3, assume that we have following controller action: public ActionResult Index()
I have multiple controller actions that takes an id public ActionResult Get(int? id) {
I have this action method in C#: public ActionResult Index() { ViewBag.Message = Hello;
I have controller: void user() { var user = (from ....); if(user !=null) {
public ActionResult Index() { var pr = db.products; return View(pr); } Firstly - I
Say I have a controller with an Index Method and a Update Method. After

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.