Problem in dropdown
-
In my page i am having a dropdownlist control. I have populated the data for this dropdown using javascript. i.e it has 5 items. But upon postback ,it says that the data in the dropdown is 0.How to solve this.
-
I think to make a Postback you must use a control that run at server... May you write your code so you make every thing clear? "I am too late but i will never give up"
see my code 1
.
2.I have used this javascript to populate the dropdown ( For sample i have used the count,it is getting at runtime)function add() { var ddlobj = document.getElementById('ddemp'); for (var count = ddlobj.options.length-1;count >-1; count--) { ddlobj.options[count] = null; } for (var count = 0; count < 5;count++) // For sample i have used the count,it is getting at runtime { value = count; text = "List" + count ; listItem = new Option(text, value , false, false); ddlobj.options[ddlobj.length] = listItem; } }
3.while clicking one more button, i am not getting the selected value. it shows ddemp.Items.Count as 0 -
see my code 1
.
2.I have used this javascript to populate the dropdown ( For sample i have used the count,it is getting at runtime)function add() { var ddlobj = document.getElementById('ddemp'); for (var count = ddlobj.options.length-1;count >-1; count--) { ddlobj.options[count] = null; } for (var count = 0; count < 5;count++) // For sample i have used the count,it is getting at runtime { value = count; text = "List" + count ; listItem = new Option(text, value , false, false); ddlobj.options[ddlobj.length] = listItem; } }
3.while clicking one more button, i am not getting the selected value. it shows ddemp.Items.Count as 0When you add them on clientside like this, they are not posted back to the server. You might want to consider putting the selected value of this listbox into a hidden field ( i assume that is what you want in the server code.)
-
When you add them on clientside like this, they are not posted back to the server. You might want to consider putting the selected value of this listbox into a hidden field ( i assume that is what you want in the server code.)