I have several data fields that I want to be on one line and kept in fixed size columns in a combo box. I have tried padding and looks good till I add to combo box, where string loses its format.
Before adding string lines they look like this.
"aaa " - "bbbbbbbb " - "ccccc "
"aaaaa " - "bbb " - "cc "
after add, listing in combo box shows this
"aaa" - "bbbbbbb" - "ccccc"
"aaaaa" - "bbb" - "cc"
I have tried stringbuilder and arrays but meet with errors such as can’t type to listitems, etc. How can you maintain a string format that is made up of several variables, in a combo box?
2
Answers
Try formatting your font with a fixed width and then using string you can format with tabs.
ie something like this
This can be done if you use a fixed size font.
You also have to convert blanks to a html non breaking space (nbsp;).
And you also have to use HTML encoding for the string.
With above in mind?
So, say we select a hotel (saving the hidden PK, but display hotel name and city and rate.
So, markup:
And code behind:
Result:
I would suggest that you pop a dialog, and thus say popup a GridView, as that would allow better formatting, but the above can work.