Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i am raghu

i have dropdownlist it having from 1 to 15 digits, and i having 15 textboxes suppose i am selected 5 i want to show only 5 textboxes, if i am select 2 only 2 textboxes want to show like that,how can i solve my problem please give me the suggesstions i am using MVC3 Razor Engine
Posted
Updated 16-Mar-14 21:14pm
v2

Add textboxes dynamically based on what is selecteed in the dropdown.
Here is a hint - How to: Add Controls to an ASP.NET Web Page Programmatically[^].
 
Share this answer
 
Comments
Member 10629036 17-Mar-14 3:21am    
Hi Abhinav i want to know in MVC3
Please give me the suggestion.
Thank you....
Abhinav S 17-Mar-14 3:22am    
http://forums.asp.net/t/1900487.aspx?MVC+4+how+to+create+dynamic+controls
Member 10629036 17-Mar-14 3:26am    
Thank you.....
Abhinav S 17-Mar-14 3:28am    
Vote if it helps.
Member 10629036 17-Mar-14 4:28am    
i Have a one more doubt how to validate(ClientSide) dropdownlist and textbox in MVC3
<script>
    $(document).ready(function () {
        $("#ddl").change(function () {
            MakeInVisibleToAll();//Write code for invisible for all
            var d = $("#ddl").val();
            for (var i = 1; i <= d; i++) {
                $("#txt" + i + "").css("display", "block");
            }
         
        });
    });
</script>
 
Share this answer
 
Comments
Member 10629036 17-Mar-14 5:27am    
The above solution what is "display" and "block"
[no name] 17-Mar-14 5:30am    
This is for textbox display with css format
First you will make display none for all textbox
then under dropdown selection it will show textboxe under you no count.
Make sure that your textboxes ids should be txt1,txt2,txt3,txt4.....txt15 etc
Member 10629036 18-Mar-14 23:19pm    
Thank you it's helpful....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900