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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:25:45+00:00 2026-05-19T17:25:45+00:00

I have an ASP.Net MVC view which inherits from a ViewModel. The ViewModel contains

  • 0

I have an ASP.Net MVC view which inherits from a ViewModel. The ViewModel contains data from two entities in the model:

public PaginatedList<Entry> Entries { get; private set; }
public SelectList ColumnValues { get; private set; }

These two properties are used on the view, which is based on a list template.
The list iterates through the Entries list and displays a table row for each of them. Within one of the table cells in the row is a DropDownList populated from the ColumnValues propery from the ViewModel.

I can get the DropDownList to set it’s selected item using the following:

@Html.DropDownList("ColumnValue", Model.ColumnValues)

This renders the page, each row with a DropDownList in one of the cells. However the selected value is always set to the ‘ColumnValue’ for the first row, and is like this for all of the rows.

How would I go about modifying my code so that the selected value of the DropDownList matches the ColumnValue for each inividual entry.

The aim is to produce a kind of editable datagrid with links to post back the changes per row using AJAX.

  • 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-19T17:25:45+00:00Added an answer on May 19, 2026 at 5:25 pm

    Using DropDownListFor() in the View and setting the selectList to the following works:

    new SelectList(Model.ColumnValues,"ColumnValue","ColumnValue", item.associatedField)
    

    This doesn’t seem to be a great way of doing things, but it works. And that’s the most important thing right now. Any further comments would be appreciated.

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

Sidebar

Related Questions

I have an ASP.NET MVC view which contains checkboxes for user-defined categories. <td><% foreach
I'm on a asp.net MVC 2 project and have a view that inherits from
I have an ASP.NET MVC view which contains some plain html. I wanna use
I have a custom view engine in ASP.NET MVC and since upgrading to RC1
I have an ASP.NET MVC-application which I want deployable on both IIS6 and IIS7
I have ASP.NET MVC controller named dictionary with method ControlsLangJsFile. Method returns view of
I have an asp.net mvc application with a route similar to: routes.MapRoute(Blog, {controller}/{action}/{year}/{month}/{day}/{friendlyName}, new
I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When
I have an ASP.NET MVC application, when a user clicks on the submit button
I have an ASP.Net MVC Ajax.BeginForm that submits and updates my page properly when

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.