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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:29:13+00:00 2026-06-01T19:29:13+00:00

I have mvc3 web application. In that i have used EF and populate two

  • 0

I have mvc3 web application.
In that i have used EF and populate two dropdownlists from database.

Now when i select values from those dropdownlists i need to show them inside webgrid
how can i do this?

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Mapping</legend>
        <div class="editor-label">
          @Html.Label("Pricing SecurityID")
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.ID,
         new SelectList(Model.ID, "Value", "Text"),
            "-- Select category --"
            )
            @Html.ValidationMessageFor(model => model.ID)
        </div>

         <div class="editor-label">
          @Html.Label("CUSIP ID")
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.ddlId,
         new SelectList(Model.ddlId, "Value", "Text"),
            "-- Select category --"
            )
            @Html.ValidationMessageFor(model => model.ddlId)
        </div>
         <p>
            <input type="submit" value="Mapping" />
        </p>
    </fieldset>
}

when i clicked on Mapping button it will goes to new page called Mapping.cshtml and have to show webgrid with those two values.

  • 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-01T19:29:15+00:00Added an answer on June 1, 2026 at 7:29 pm

    I would create a ViewModel

    public class YourClassViewModel
    {
    
     public IEnumerable<SelectListItem> Securities{ get; set; }
     public int SelectedSecurityId { get; set; }
    
     public IEnumerable<SelectListItem> CUSIPs{ get; set; }
     public int SelectedCUSIPId { get; set; }
    

    }

    and in my Get Action method, I will return this ViewModel to my strongly typed View

    public ActionResult GetThat()
    {
       YourClassViewModel objVM=new YourClassViewModel();
       objVm.Securities=GetAllSecurities() // Get all securities from your data layer 
       objVm.CUSIPs=GetAllCUSIPs() // Get all CUSIPsfrom your data layer    
       return View(objVm);  
    }
    

    And In my View Which is strongly typed,

    @model YourClassViewModel     
    @using (Html.BeginForm())
    {
        Security :
         @Html.DropDownListFor(x => x.SelectedSecurityId ,new SelectList(Model.Securities, "Value", "Text"),"Select one") <br/>
    
        CUSP:
         @Html.DropDownListFor(x => x.SelectedCUSIPId ,new SelectList(Model.CUSIPs, "Value", "Text"),"Select one") <br/>
    
      <input type="submit" value="Save" />
    
    }
    

    and now in my HttpPost Action method, I will accept this ViewModel as the parameter and i will have the Selected value there

    [HttpPost]
    public ActionResult GetThat(YourClassViewModel objVM)
    {
       // You can access like objVM.SelectedSecurityId
       //Save or whatever you do please...   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created an mvc3 web application that uses forms based authentication. one part
This is about asp.net mvc3 web application. We have used Object cache to store
I have MVC3 web application where we need to populate radio button list with
I need to develop a web application, i have two choices mvc3 straight forward
I am writing a web application on Asp.Net MVC 3. Assume that we have
I have two projects in my solution... a domain project and MVC3 web project
I am working on an MVC3 web application. One of my requirements is that
I have created an ASP.Net MVC Web Application and used NuGet to install Ninject
So I have this application in ASP MVC 3. My database has two tables:
I have MVC3 web application running under IIS 7. During initialization in global.asax application

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.