Select an item of a combobox when using ItemTemplate

Posted by: pchanez on 10 September 2017, 11:27 am EST

  • Posted 10 September 2017, 11:27 am EST

    I'm trying to set the selected item of a combobox and when I'm using ItemTemplate, I do not manage to have it work

    Here's what I'm doing :
    c1ComboBox.FindItemByValue(SelectedValue).Selected = true

    If I put a break point during the rendering, the Text property is correct but in the browser it doesn't diplay. The very same code works fine when I'm not using the itemTemplate

  • Replied 10 September 2017, 11:27 am EST

     Hi pchanez,


    I checked this problem and found that this is a issue in C1ComboBox.  The input is created in CreateChildControls before your custom code is executed. I will fixed it in the new build.


    You can set the input value by yourself as a workaround.

     Following is the code needed.

           C1ComboBoxItem item = C1ComboBox1.FindItemByValue("test");
            if (item != null)
                item.Selected = true;
                // set input value before rendering.
                ((HtmlInputText)C1ComboBox1.Controls[0].Controls[0].Controls[0].Controls[0]).Value = item.Text;

     If you have any other problem please let me know. 




Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels