Display null value

2 posts, 0 answers
  1. jbaird
    jbaird avatar
    19 posts
    Member since:
    Jul 2012

    Posted 21 Apr 2009 Link to this post

    I am trying to bind a null foreign key to a specific value in the combo box itemssource.  Below is the relevant code.  Do you have any suggestions on how to make this display "None" instead of remaining blank?

    /// <summary>

    /// Event handler

    /// </summary>

    private void ClientBiz_OnDataListRefreshed(object sender, ClientBizNew.DataListRefreshedEventArgs e)


        //Get the xml and clear the respective list.

        string xml = this.ClientBiz.GetDataListResult(e.ServiceName, e.QueryName);

        if (!string.IsNullOrEmpty(xml))


            XDocument xd = XDocument.Parse(xml);


    if (e.ServiceName.Equals("GLChart"))



                    _chartList.Add(new GLChartObject() { GLChartKey = null, GLChartName = "None" });




                //get the xml nodes

                var nodes = from x in xd.Descendants(e.ServiceName) select x;


                //set the properties in the corresponding data class

                foreach (var n in nodes)


                    if (e.ServiceName.Equals("GLChart") && e.QueryName.Equals("GETALL"))


                        int key = Convert.ToInt32(n.Element("PK_GLChart").Value);

                        string name = n.Element("ChartName").Value;


                        _chartList.Add(new GLChartObject() { GLChartKey = key, GLChartName = name });






                //set the binding of the respective combo box to the list.

                if (e.ServiceName.Equals("GLChart"))


                    this.cboChartOfAccounts.ItemsSource = _chartList;





    public class GLChartObject


        public int? GLChartKey { get; set; }

        public string GLChartName { get; set; }



    <bfgs:RadComboBox x:Name="cboChartOfAccounts"


                      SelectedValue="{Binding FK_GLChart, Mode=TwoWay}"









    Thanks for your help.

  2. Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 21 Apr 2009 Link to this post

    Hello jbaird,

    I am afraid that the officially released version of RadComboBox (2009 SP1) has a bug that breaks scenarios like yours. I managed to fix it and I will be able to send you the new assemblies + sample application tomorrow (the build needs to be tested). Since this is a forum post, I am allowed to attach only trial assemblies here. Please, open a new support ticket if you want the developer assemblies (without trial check).

    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top