Checked State lost in Combobox

6 posts, 0 answers
  1. Erik Beyer
    Erik Beyer avatar
    8 posts
    Member since:
    Feb 2007

    Posted 24 Nov 2010 Link to this post

    Hi,

    i am using a RadTreeview with CheckBoxes within a RadComboBox. Everything works fine, but the Combox collapses every time I Check a Node. I found a solution using the StopPropagation Function in JavaScripting preventing this behaviour, but now i am facing another problem: The Nodes I had checked are not checked anymore when submitting the form.

    How can I prevent the ComboBox from collapsing AND persist the Checked States and reading them in code behind after submitting the form?

    Following Code I use:

    function StopPropagation(e) {
                if (!e) {
                    e = window.event;
                }
     
                e.cancelBubble = true;
            }



    <rad:RadComboBox ID="ddYearQuarterMonthDate" runat="server" Width="100%" Height="350px">
                                                        <ItemTemplate>
                                                            <div id="div1" onclick="StopPropagation(event);">
                                                            <rad:RadTreeView ID="radTreeViewYearQuarterMonthDate" runat="server" MultipleSelect="True" CheckBoxes="true"
                                                        TriStateCheckBoxes="false" CheckChildNodes="false" onclick="EmptyRadDatesAndRblTimespan();">
                                                            </rad:RadTreeView>
                                                            </div>
                                                        </ItemTemplate>
                                                        <Items>
                                                            <rad:RadComboBoxItem Text="" />
                                                        </Items>
                                                    </rad:RadComboBox>

                                   
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 25 Nov 2010 Link to this post

    Hello Erik Beyer,

    I'm glad you've figured out that by using the StopPropagation function you can disable the collapsing of the RadComboBox. I've created a sample project to show you RadTreeView in Combobox with checkboxes. Please note that if you ajaxify the combobox with AjaxPanel or AjaxManager - you will not be able to view the checked nodes after postback.

    Please take a look at the attached .zip file and let me know if you have some questions.
     
    Greetings,
    Veronica Milcheva
    the Telerik team
    Browse the vast support resources we have to jumpstart 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. Erik Beyer
    Erik Beyer avatar
    8 posts
    Member since:
    Feb 2007

    Posted 25 Nov 2010 Link to this post

    Unfortunately still no success. I am using exactly your code within my page, but still are no nodes are Checked within the code behind when hitting the submit button. Its not nested in a Updatepanel. Maybe its because of the fact that I am using this whole thing within a RadWindow?
  4. Erik Beyer
    Erik Beyer avatar
    8 posts
    Member since:
    Feb 2007

    Posted 25 Nov 2010 Link to this post

    ... and when setting TriStateCheckBoxes="true" then everything works fine with no collapsing ComboBox, BUT: during PageLoad I check the nodes programmatically, from which the value i saved in my Session variable and they does not appear checked after page is loaded.

    Here my code for checking the nodes programmatically:

    ddYearQuarterMonthDate.Items.Add(new RadComboBoxItem(""));
                RadTreeNode treeParentNode = null;
                RadTreeView radTreeViewYearQuarterMonthDate = (RadTreeView)ddYearQuarterMonthDate.Items[0].FindControl("radTreeViewYearQuarterMonthDate");
                int level = 1;
     
                foreach (DataRow dr in dt.Rows)
                {
                    if (Convert.ToInt16(dr["[Measures].[ParameterLevel]"]) > 0 && Convert.ToDateTime(dr["[Measures].[EntryDate]"]).Year > DateTime.Now.AddYears(-6).Year && Convert.ToDateTime(dr["[Measures].[EntryDate]"]) <= DateTime.Now)
                    {
                        if (Convert.ToInt16(dr["[Measures].[ParameterLevel]"]) != level)
                        {
                            level = Convert.ToInt16(dr["[Measures].[ParameterLevel]"]);
                            treeParentNode = radTreeViewYearQuarterMonthDate.FindNodeByText(dr["[Measures].[ParameterParentCaption]"].ToString());
                        }
     
                        RadTreeNode treeChildNode = new RadTreeNode(dr["[Measures].[ParameterCaption]"].ToString(), dr["[Measures].[ParameterValue]"].ToString());
     
                        if (level == 1)
                            radTreeViewYearQuarterMonthDate.Nodes.Add(treeChildNode);
                        else
                            treeParentNode.Nodes.Add(treeChildNode);
     
                        if (SessionFacade.TimespanValue != null)
                            if (SessionFacade.TimespanValue.Contains(treeChildNode.Value))
                                treeChildNode.Checked = true;
     
                    }
                }
  5. Elke Kaminski
    Elke Kaminski avatar
    6 posts
    Member since:
    Mar 2009

    Posted 29 Nov 2010 Link to this post

    I have the same Problem. Can you guys from the suport team please help us out?!

    Thanks
    Claudio
    (Business Intelligence Group GmbH)
  6. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 01 Dec 2010 Link to this post

    Hello Elke Kaminski,

    Could you please open new support ticket and attach the full code so I can inspect it and help you?

    Thank you!

    Regards,
    Veronica Milcheva
    the Telerik team
    Browse the vast support resources we have to jumpstart 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