I want to fill data into select control like:

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

And my code

ArrayList arr = new CMProduct().getList();
        string str = "<option value='0'>" + strApp + "</option>";
        if (arr != null)
        {
            foreach (MProductInfo info in arr)
            {
                string select = "";
                string sName = "";
                if (info.ID == id_select)
                    select = "selected";
                //int length = 80;
                int fLengthString = info.Name.Length;
                int iPadRight = 0; iPadRight = 100 - fLengthString;
                sName = info.Name.PadRight(iPadRight, '\u00a0');
                str += "<option " + select + " value='" + info.ID + "'>" + sName + info.Code + "</option>";
            }
        }
        return str;

Ressult:

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

So how to fix it?

Related posts

Recent Viewed