FormatString?

4 posts, 0 answers
  1. Mateo
    Mateo avatar
    17 posts
    Member since:
    Aug 2007

    Posted 16 Aug 2007 Link to this post

    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.
  2. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 17 Aug 2007 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mateo
    Mateo avatar
    17 posts
    Member since:
    Aug 2007

    Posted 20 Aug 2007 Link to this post

    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;
    }

  5. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 21 Aug 2007 Link to this post

    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
Back to Top