c# - Passing Enum value in a method from dropdown? -


i need call method webservice, expects parameter enum.

there 2 parts of question:

1) how bind drop enum values?

2) how pass selected value drop down webservice method enum type?

can me in this?

regards

i have ans of first question

enum encountries:int{india=0,usa,uk,uae};// declare enum  var enumnames=enum.getnames(typeof(encountries)); //convert string array foreach (string item in enumnames) { //get enum item value int value = (int)enum.parse(typeof(encountries), item); listitem listitem = new listitem(item, value.tostring()); dropdown.items.add(listitem); // bind dropdown } 

selected value of dropdown gives single values why want convert single value enum..???

for second question first create enum

  enum enumname{}   enum.parse(typeof(enumname), dropdownselectedvalue, true); //this convert selected value enumname type  

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -