PharmacyLocationCollection pharmcol =
new
Select()
.From(Tables.PharmacyLocation)
.OrderAsc(PharmacyLocation.Columns.Location)
.ExecuteAsCollection<PharmacyLocationCollection>();
//ddlLocation.Items.Insert(0, new RadComboBoxItem("--select a location--", "0"));
if
(pharmcol.Count > 0)
{
int
i = 0;
foreach
(PharmacyLocation p
in
pharmcol)
{
string
loc = p.Location.ToString();
loc = loc.Replace(
"-"
,
"\n"
);
ddlLocation.Items.Insert(i,
new
RadComboBoxItem(loc, p.RXPharmacyID.ToString()));
i++;
}
ddlLocation.Enabled =
true
;
}
6 Answers, 1 is accepted

Hi Telerik,
Is there a way to add a line break in a combobox?
Thank You!
Hello,
RadComboBox uses an <input type="text"> for its actual input and that does not support new lines.
You can, however, have new lines in the HTML presentation - you can insert <br /> elements in the template of the items: http://docs.telerik.com/devtools/aspnet-ajax/controls/combobox/templates/overview.
Note that the Value should still be a "regular" string without new lines.
Regards,
Telerik by Progress

I have a Radcombobox that is populated using the database and also by hard coding some values. It allows for multiple selections and custom text. I would like to add line breaks as well, just like a textbox; you press 'Enter' it adds a line break and saves it to the database.
I need a line break because the information is displayed in a telerik report. If is not possible to add it to the combobox to save it to the database, would it be possible to accomplish a line break in the telerik report?
For example :
John Smith / and Lisa Smith (read this from the database)
John Smith and
Lisa Smith (display this on report by replacing '/' with a line break)
Thanks for your help.

Never mind, I figured it out.
Thank You!


Hi Ken,
Since RadComboBox doesn't support new lines. I had to find a way around it, so I did it using sql.
SELECT Replace(Name, '\', char(13))
Not the perfect solution but it works.