I want to bind the HTML select element with the database.
I want to bind the text and value of select element
The problem is dont want to return the string array with text and value of each option combined using some symbol rather i want to return an array list or some List
Now after returning using PageMEthods i cannot iterate over the result to get the id and value of select options.
I cannot use JSON i have to use PageMethods only.
ArrayList obj = new ArrayList();
var countries = EntityService.ServiceInstance.GetCountries();
foreach (var country in countries)
{
ListItemClass temp = new ListItemClass();
temp.ListItemText = country.country_name.ToString();
temp.ListItemValue = country.id.ToString();
obj.Add(temp);
}
return obj;
What I want is how can I get the ID and country name in jQuery
Any help is appreciated.
Thanks
PROBLEM SOLVED:
I need to write :
where test is the return type of method
$.each(test,
function (intIndex, objValue) {
$.each(objValue, function (intIndex1, objValue1) {
alert(objValue1);
})
}
);
But dont know whether this is a correct approach or not.
PageMethods?