Reputation: 3294
i have a project on MVC3 and Razor. I'm doing on my project everything without javascript first and then in the future when everything works without JS, then i will add the JS functionallity. The thing is that i have a razor page, that i fill from the Model a select and what i need is that when the select option changes, then another select must be filled. My idea is that in the Model i have a collection of the object that needs the second select to get filledm, and when the onchange event of the first select is triggered, i call a method on the controller that fills the list on the model and in the view side, i fill the second select with a foreach over the list. My question is.. how do i fire the onchange event on a ? Notice that i'm not using Html.DropDownList or something like that.. but if it´s necessary, i will.
Thanks and i hope you can hellp me!
Upvotes: 1
Views: 646
Reputation: 5002
The select
onchange
event requires Javascript. To handle when Javascript is disabled you usually add something like an "Update" submit button
within <noscript>
tags to update the selection using a server post. The <noscript>
tags will only show when Javacript is disabled.
Upvotes: 1