RadDropdownTree.Selected Value cannot be assigned to

6 posts, 1 answers
  1. Allan
    Allan avatar
    9 posts
    Member since:
    Feb 2013

    Posted 19 Jun 2013 Link to this post

    Hi,

    I'm trying to pre-check all checkboxes with a RadDropdownTree control after it has been bound to (as per the sample code here) but I am getting a 'RadDropDownTree.SelectedValue' cannot be assigned to -- it is read only' error.

    I've had a look about online to check for a versioning issue but couldn't see anything - I'm currently using release 2013.1.403.35, is this the issue?

    Thanks,
    Allan
  2. Answer
    Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 20 Jun 2013 Link to this post

    Hi Allan,

    The setter functionality comes with Q2.2013. So you need to update in order to use it. In case that it is not possible for you, please use the following approach.

    Regards,
    Peter Filipov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Paul
    Paul avatar
    17 posts
    Member since:
    May 2011

    Posted 27 Aug 2013 Link to this post

    I bind my RadDropDownTree using the methods below but whenever I set the SelectedValue it never sets. It's always blank, even though I have checked the SelectedValue is in the datatable.

    I use "rdtPOLineItemID.SelectedValue = "pl" + am.POLineID.ToString();" to set the SelectedValue.

    I am using Telerik Version 2013.2.717.45

    Any help would be greatly appreciated.

    Regards, Paul.

    private void PopulatePOLineItems()
            {
                rdtPOLineItemID.DataFieldID = "ID";
                rdtPOLineItemID.DataFieldParentID = "ParentID";
                rdtPOLineItemID.DataValueField = "Value";
                rdtPOLineItemID.DataTextField = "Text";
                rdtPOLineItemID.DataSource = BuildDataTable(Convert.ToInt32(Session["ProjectID"]));
                rdtPOLineItemID.DataBind();
            }
     
            private static DataTable BuildDataTable(int projectid)
            {
                DataTable dt = new DataTable();
     
                dt.Columns.Add("ID");
                dt.Columns.Add("ParentID");
                dt.Columns.Add("Value");
                dt.Columns.Add("Text");
     
                DataTable po = cPurchaseOrder.GetAllPurchaseOrdersByProjectID(projectid);
     
                foreach (DataRow dr in po.Rows)
                {
                    dt.Rows.Add(new String[] { "p" + dr["purchaseorderid"].ToString(), null, dr["purchaseorderid"].ToString(), dr["purchaseordernumber"].ToString() });
     
                    DataTable polines = cPurchaseOrderLineItem.GetPOLineItemsByPOID(Convert.ToInt32(dr["purchaseorderid"].ToString()));
     
                    foreach (DataRow podr in polines.Rows)
                    {
                        dt.Rows.Add(new String[] { "pl" + podr["polineitemid"].ToString(), "p" + podr["poid"].ToString(), "pl" + podr["polineitemid"].ToString(), podr["polineitemnumber"].ToString() });
                    }
                }
     
                return dt;
            }
  5. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 30 Aug 2013 Link to this post

    Hi Paul,

    Please set SelectedValue property after the control is bound. When the value of the property is not found in the Items' values no nodes are checked or selected. To verify that the value exist please handle NodeDataBound event and check for such value.

    Regards,
    Peter Filipov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  6. Stacy
    Stacy avatar
    98 posts
    Member since:
    Dec 2010

    Posted 22 Apr 2015 in reply to Peter Filipov Link to this post

    I have a RadDropDownTree:

    <telerik:RadDropDownTree
    runat="server"
    ID="OrganizationUnitDropDownTree"
    Width="250px"
    DefaultMessage="Choose a department"
    DataTextField="Description"
    DataFieldID="OrganizationUnitHierarchyId"
    DataFieldParentID="ParentOrganizationUnitHierarchyID"
    TextMode="FullPath" >

    <DropDownSettings Height="140px" CloseDropDownOnSelection="true" />

    </telerik:RadDropDownTree>

     

    I want to select an item via server side but cant seem to.  My c# code is:

    public void LoadOrgUnitDropDownTree()
    {
    OrganizationUnitDropDownTree.DataSource = GetData();
    OrganizationUnitDropDownTree.DataBind();
    OrganizationUnitDropDownTree.ExpandAllDropDownNodes();

    OrganizationUnitDropDownTree.SelectedValue = "1";

    }

    But that does not seem to do anything. 

     My question would be how to select server side based on an id.

    I have also tried using "41,33" which is an item  (41) and parent (33) id but that also does not work.

    Please advise.

     

     

  7. Stacy
    Stacy avatar
    98 posts
    Member since:
    Dec 2010

    Posted 22 Apr 2015 in reply to Stacy Link to this post

    Nevermind, I was missing the attribute "DataValueField"
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017