Tien Quang

Tien Quang

  • NA
  • 5
  • 945

format dropdownlist control have two columns

Mar 20 2015 3:57 AM

I want to fill data into select control like:

abc        || 1
bcde      || 2
ghiftt     || 3  

And my code

string str = "<option value='0'>" + strApp + "</option>";
if (arr != null)
{
foreach (MProductInfo info in arr)
{
string select = "";
if (info.ID == id_select)
select = "selected";
string sName = string.Format("{0}{1}", info.Name.PadRight(70, '\u00A0'), info.Code);
str += "<option " + select + " value='" + info.ID + "'>" + sName + "</option>";
}
}
return str; 
Ressult:

abc || 1
bcde || 2
ghife  || 3

So how to fix it?


Answers (2)