[RESOLVED]Repeat single dropdownlist multiple times

Hi All,

I searched lot in net, but unable to find any link for my problem.

I have requirement to repeat the single dropdown multiple time

How many kids do you have : text box

Age group : dropdownlist(1-6,6-10,10,18,19+)

if we enter 2 as a kids then 2 dropdownist for selecting age group has to come… if we enter 4  as kids then 4 dropdownlist has to come for each kids

how can i do this? any sample code?

You may have to use jquery for dynamically append the drop down to your page and after use "Form Collection" in your controller to get all values with element name.

var dropdown=$("#dropdown").html();

$("#textbox").change(function() {

var val=$(this).val(); 
for(var i=0;i<val;i++)
{
$("#div").append(dropdown);
}
});

Hope this will work. Smile

Thanks for the reply.

But I did it with partial view and some ajax call for creating list and saving the list.

Its all working fine now

Leave a Reply