This is a migrated thread and some comments may be shown as answers.

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

3 Answers 77 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Gerhard
Top achievements
Rank 1
Gerhard asked on 09 Jul 2012, 07:02 PM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 12 Jul 2012, 11:14 AM
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.
0
Gerhard
Top achievements
Rank 1
answered on 12 Jul 2012, 03:10 PM
Hi Tsvetina,

thanks a lot, that did the trick.
br
Gerhard
0
Gopi
Top achievements
Rank 2
answered on 12 Dec 2014, 04:33 AM
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;
Tags
TreeList
Asked by
Gerhard
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Gerhard
Top achievements
Rank 1
Gopi
Top achievements
Rank 2
Share this question
or