I had populated an ASP.net dropdown list with AJAX now I need to get the Id to store in into the database in a C# method, (I\'m using LINQ)
This is my webmethod
You can't get selected value from DropDownList
if you adding options in javaScript
. You can try the following
string selectedValue = Request.Form[ddlLanguage.UniqueID];
This question may be useful also.
If you populate the value of dropdown via ajax than it can't be available on Server Side because the page doesn't postback during ajax request.
In order to get the value of dropdown in C# use below snippets :
String _value = Convert.ToString(Request[ddlLanguage.ClientID]);
Hope this will help !!