Setting Header text in Codebehind for a MultiColumn ComboBox.

2 posts, 0 answers
  1. Guido S
    Guido S avatar
    16 posts
    Member since:
    Aug 2009

    Posted 26 Nov 2012 Link to this post

    Hello There,

    I kinda have a problem because i would like to set the header data (titles) using the code behind.
    cbxName.Header.FindControl("id") doesn't really do the trick.

    Why do I need this? Well I need to set the titles in the proper languages.

    Thanks in advance.
  2. Guido S
    Guido S avatar
    16 posts
    Member since:
    Aug 2009

    Posted 27 Nov 2012 Link to this post

    YES I HAVE FOUND A SOLITION!
    I think it is kinda crappy and dirty since you have to create a HeaderTemplate class for every RadComboBox you would like to do this.

    class ProductSelectorHeaderTemplate : ITemplate
    {
        private string _artNr, _name, _brand;
        public void SetHeaderTexts(string artNr, string name , string brand)
        {
            _artNr = artNr;
            _name = name;
            _brand = brand;
        }
     
        public void InstantiateIn(Control container)
        {
            var lt1 = new Literal() {Text =  "<ul><li class='col1'>" + _artNr + "</li>"};
            var lt2 = new Literal() { Text = "<li class='col2'> " + _name + "</li>" };
            var lt3 = new Literal() { Text = "<li class='col3'> " + _brand + "</li></ul>" };
            container.Controls.Add(lt1);
            container.Controls.Add(lt2);
            container.Controls.Add(lt3);
        }
    }

    I have placed this in the init of the ascx.cs file       

    var headerTemplate = new ProductSelectorHeaderTemplate();
    headerTemplate.SetHeaderTexts("BLA", "BLABALAA", "i like banana");

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top