This is a migrated thread and some comments may be shown as answers.

FormatString?

3 Answers 302 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mateo
Top achievements
Rank 1
Mateo asked on 16 Aug 2007, 10:07 PM
I must admit that i don't see how to use this property?
Let say i wanna bind to employee object with property FirstName and LastName and see [LastName, FirstName] in combobox. how can i achieve this?

Can you provide a simple example please?
Thanks.

3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 17 Aug 2007, 01:47 PM
Hi mateo,

The FormatString is usually used when the values from one field (the one that DisplayMember points to) of the data source need to be formatted. The same format string is applied on all items in the combobox, so it is not possible to combine values from two fields, the way you need. Since your case is not possible at the moment, we're going to implement a Format event that could be used for similar purposes. It will probably be available in the next release of our controls (Q2 2007).
 

Sincerely yours,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mateo
Top achievements
Rank 1
answered on 20 Aug 2007, 08:55 PM

I found that handling the ItemDataBound event of the radcombobox and setting the DataBoundItem.Text property would produce the desired result ?

Is it ok to do it like this?

void ComboboxTO_ItemDataBound(object sender, ItemDataBoundeventArgs e)

{

e.DataBoundItem.Text = to.ToCode + "-" + to.ToName;
}

0
Dwight
Telerik team
answered on 21 Aug 2007, 01:04 PM
Hello Mateo,

What you suggest is a nice workaround. It is perfectly OK to set custom formatting as you do. Note that this is the only possible way if you want to place conditional formatting based on the value from the data source.

 
Best,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Mateo
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Mateo
Top achievements
Rank 1
Dwight
Telerik team
Share this question
or