How to add and fire events of dropdown list created dynamically in mvc3
I have an mvc3 application.In which I am using razor view..I have some problems related to dynamically hiding and unhiding the controls also creating controls dynamically.
Problems:
I want to dynamically hide or unhide some div tag according to value of some form control without using java script. ex: Like I have a dropdown list to select the value..If the selected value is "other" then need to show a text box (which is hidden initially).
I want to create more than 1 dropdown list dynamically on the basis of value of a dropdown list on a form and also want to show some data on selecting of any dropdown item created dynamically. I have a dropdown list "List1" which has 2 values ex value1 and value2..If we select value1 from dropdown then how can we create more than 1 dropwdown list dynamically. If we select any value from the dynamically created dropdown list then how can I show some information related to it on the page.
Is there any solution to perform above operations without using custom javascript or can we use unobstrusive javascript?
Th开发者_StackOverflow社区anks in Advance..
For hide/unhide div tags or any controls, you need to use set style as hidden. but you need to use javascript to setting style at client side.
In MVC, its not possible to create controls at runtime. we can hide/show already controls based on your selection.
精彩评论