TreeView in RadComboBox Issues

4 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 11 Apr 2011 Link to this post

    Hello,

    I am trying to use the treeview in the RadComboBox: http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/treeviewcombobox/defaultcs.aspx?product=combobox

    I'm having two issues I can't figure out why:

    1. The text of the item isn't changing when disabled.  When the control is disabled to prevent the user from changing the value, the value is not changing when set from server-side code.  I have rcbCode.Items[0].Text = "New Value", but the old value still appears.
    2. Initially, when hitting the drop down the first time, the drop down is pretty small, but later on it returns to the correct size.  I am explicitly setting a CSS class for the drop down at 500px, but the first time it drops down to 200px.

    Any ideas why?

    Thanks.
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 14 Apr 2011 Link to this post

    Hello Brian,

    Please verify, if you experience the same problems on the sample test page provided.

    If I'm missing something in your scenario, please open a support ticket and provide us with sample project so we could examine it locally.

    Regards,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 14 Apr 2011 Link to this post

    Hello,

    I was able to reproduce the issue with the following code.  Set in the markup Enabled="false", and replace your code-behind with:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;


    public partial class Default42 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


        }

        protected void Button1_Click(object sender, EventArgs e)
        {
    var tree = RadComboBox1.Items[0].FindControl("RadTreeView1") as RadTreeView;
    tree.FindNodeByText("Nairobi").Selected = true;

    RadComboBox1.Items[0].Text = "Nairobi";
        }

    protected override void OnPreRender(EventArgs e)
    {
    base.OnPreRender(e);

    var tree = RadComboBox1.Items[0].FindControl("RadTreeView1") as RadTreeView;
    tree.FindNodeByText("Cape Town").Selected = true;

    RadComboBox1.Items[0].Text = "Cape Town";

    }
    }

    And you'll get the issue.

    HTH.
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 19 Apr 2011 Link to this post

    Hi Brian,

    The problem you are experiencing is due to the fact that the OnPreRender event is fired after the OnClick event of the button and thus you overwrite the change made in the OnClick event. This is why you always have "Cape Town" selected in your treeview.

    Regards,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top