locked
How to display data on the same page based on 2 drop-down list selection? RRS feed

  • Question

  • User747696199 posted

    Hi,

    I'm building an ASP.NET app with MVC3, EF4. I came across a situation where I'd like to do the following:

    1) when the user goes to the index.cshtml page, I'd like to first display 2 drop-down lists so the user can select the categories; the 2nd drop-down list will further narrow the selection;

    2) Based on the 2 selections, I want to display the qualified data Right Below the 2 drop-down lists, on the SAME page. SO ideally as soon as the user select a value from the 2nd drop-down list, the data will appear immediately below.

    Note: the 2 fields for the 2 drop-down lists and the data to be displayed below are ALL from the SAME TABLE.

    Now My questions:

    1) SelectList: I never used SelectList before; so even though I have an idea that for 1) I should use SelectList, and made the first drop-down list work; but I don't know how to make the 2nd drop-down list work.

    2) How to display the data below?

    3) Should I use Ajax or can I use it here? I never used Ajax before this.

    If anyone can show me some sample code, for both View and Controller, that'll be great! Or provide a link with any sample code so I can get an idea.

    Thanks,

    Claudia

    Wednesday, April 18, 2012 8:50 AM

Answers

All replies