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

NestedViewTemplate on client side

4 Answers 224 Views
Grid
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 19 Mar 2009, 10:03 PM
Hi folks
I am trying to update a label I have in a NestedViewTemplate on the client side in the RowDataBound event. Does anyone know how I can do this? Here is what I have tried but it doesn't work. FindControl doesn't find the control:
        function RadGrid1_RowDataBound(sender, args)
            {
                var label1 = args.get_item().findControl("lblReferenceValue"); // find control
                label1.set_value(args.get_dataItem()["ReportSourceId"]);
            }
Here is my markup:
            <NestedViewTemplate>
                <asp:Table ID="tblDetails" runat="server">
                    <asp:TableRow ID="trReference">
                        <asp:TableCell>
                            <asp:Label ID="lblReferenceValue" runat="server" Text="Reference:" />

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 20 Mar 2009, 06:32 AM
Hello William,

You can try findElement instead findControl on the following line:
var label1 = args.get_item().findControl("lblReferenceValue"); // find control

Please give it a try and see whether it helps.

Best wishes,
Nikolay
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
William
Top achievements
Rank 1
answered on 22 Mar 2009, 10:57 PM
Hi Nikolay

Thanks for the reply. Unfortunately that doesn't work either!
The problem seems to be that from the RowDataBound event there doesn't seem to be any way of getting to the nested view template. I can get the data row itself by calling args.get_item(), but once I have this there doesn't seem to be any way of getting the nested view template associated with this row.
I would imagine that once I have the nested view template that it would be possible to find the controls on it...
Any further advice??
0
Accepted
Nikolay Rusev
Telerik team
answered on 26 Mar 2009, 08:10 AM
Hello William,

For your convenience I've prepared sample application. You can find it attached to this post.
It demonstrates how on RowDataBound client-side event you can find control in NestedViewTemplate.

I hope this helps.

Best wishes,
Nikolay
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
William
Top achievements
Rank 1
answered on 26 Mar 2009, 10:20 PM
Thanks Nikolay
Works perfectly! I knew there had to be a simple way of doing it!
Thanks
Tags
Grid
Asked by
William
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
William
Top achievements
Rank 1
Share this question
or