Reputation: 212
I am filling dropdownlist with javascript.
for (var i = 1; i < array.length; i++) {
var optn = document.createElement("OPTION");
optn.text = array[i];
optn.value = array[i];
document.getElementById('<%=ddlProductModel.ClientID%>').(options.addoptn);
}
But I can't get selectedValue of dropdownlist on postback in codebehind(c#). Any solution pls? Thanks.
Yasin
Upvotes: 2
Views: 319
Reputation: 6944
You can not access selected element by dropdownlist.SelectedValue
when values added on client side. Try to use Request.Form["dropdownlistid"]
Upvotes: 2