RadTreeList with RadGrid in Master/Detail with usercontrols not working?

4 posts, 1 answers
  1. Gerhard
    Gerhard avatar
    2 posts
    Member since:
    Jul 2012

    Posted 09 Jul 2012 Link to this post

    I have two usercontrols.
    usercontrol1 uses a treeview, usercontrol2 uses a grid.
    usercontrol2 should show the details of the selected item of usercontrol2

    I hope to achieve this by setting the ControlParameter of the Datasource of usercontrol2

     <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:Paket %>"
            SelectCommand="SELECT * FROM [tLog] WHERE pPaketID=@pPaketID">
            <SelectParameters>
    <asp:ControlParameter ControlID="ctl00$MainContent$PaketListe1$RadTreeList1" Type="Int64" Name="pPaketID" DefaultValue="0" PropertyName="SelectedValue" />
            </SelectParameters>
            </asp:SqlDataSource>

    I get an error, stating that

    DataBinding: Telerik.Web.UI.RadTreeList does not contain a property with the name 'SelectedValue'.


    Have I done the wrong thing, made a stupid mistake or am I wanting the impossible?

    thx

    Gerhard
  2. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 12 Jul 2012 Link to this post

    Hello Gerhard,

    RadTreeList indeed does not have a SelectedValue property, so you would need a different approach. Having in mind the two controls are in different user controls a server-side approach would rather be needed.
     
    You could make the treelist postback on item click RadTreeList1.ClientSettings.AllowPostBackOnItemClick = "true" and in the ItemCommand event save the clicked row value in Session. Clear this value on each Page_Load event of this same user control.
    Then, in the PreRender event of the other user control check if there is such value and if so, modify the select parameter of the datasource control accordingly.
    Finally, call Rebind() for the grid.

    Kind regards,
    Tsvetina
    the Telerik team
    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 their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gerhard
    Gerhard avatar
    2 posts
    Member since:
    Jul 2012

    Posted 12 Jul 2012 Link to this post

    Hi Tsvetina,

    thanks a lot, that did the trick.
    br
    Gerhard
  5. Gopi
    Gopi avatar
    15 posts
    Member since:
    Jan 2013

    Posted 11 Dec 2014 in reply to Tsvetina Link to this post

    Hello Gerhard,

    You could make the treelist postback on item click
    RadTreeList1.ClientSettings.AllowPostBackOnItemClick = "true" as posted by Tsvetina and in the
    ItemCommand event to retrive the value of selected column u can make use of code like this................

    TreeListDataItem dataItem = e.Item as TreeListDataItem;
                RadTreeList1.ClientSettings.AllowPostBackOnItemClick = true;
                TableCell cell = dataItem["ColumnName"];
                string value = cell.Text;
Back to Top