0

I am new to mvc3. My question is how can we display the database values in a combobox in mvc3 and then, based on the selected value display data from another table in the same database?

@Html.ActionLink(temp.sectorName, "selected_sector", new {id = temp.sector.sectorId})

After running the program if I click the sectorName from the combo-box, the matching sectorId is selected and then passed into an action named selected_sector

How I can do the same thing, if I use a combo-box/dropdown list?

I want to display all sectorNames from the database named "sector" in a combo-box. When I click any sector, then its id should be passed into the same view, and then on the basis of this id, the data from another table in the database should be displayed.

e.g. if I select the sector fedral_area from the option; suppose its id is 10, and then I want to display its complete info from another table, i.e its location, area address etc.

Kindly help me how to do this.

weltraumpirat
  • 22,544
  • 5
  • 40
  • 54
Haris Qureshi
  • 39
  • 1
  • 5

1 Answers1

0

Have a look:

Asp.Net MVC3 - How create Dynamic DropDownList

Create a Dropdown List for MVC3 using Entity Framework (.edmx Model) & Razor Views && Insert A Database Record to Multiple Tables - here

And some video

Community
  • 1
  • 1
NoWar
  • 36,338
  • 80
  • 323
  • 498