yasin
yasin

Reputation: 212

Get SelectedValue of dropdownlist which is created with javascript

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

Answers (1)

hkutluay
hkutluay

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

Related Questions