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

[Solved] Scope when databinding

1 Answer 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Soren Michelsen
Top achievements
Rank 1
Soren Michelsen asked on 15 Sep 2009, 09:49 PM
This RadGrid is very new to me, having just begun my evaluation of the product yesterday. I may be way off in everything you see below... :-)

I have a RadGrid with a NestedViewTemplate. Inside of that, I have a RadTabStrip that deep inside it has three RadPageViews. No problem there. One of them looks like this:

<telerik:RadPageView runat="server" ID="pvGraph" > 
    <chart:WebChartViewer ID="myChartControl" runat="server" Width="400px" Height="300px" /> 
</telerik:RadPageView> 

Using a different charting component is not an option at the moment. If I use the charting-component in a "bare-bones" asp.net page, i would then generate and display the graph using this code:

Dim myChartHelper As chartHelper = New chartHelper(dbConnectionString) 
myChartHelper.GetChartWeb(myChartControl, gridView1.SelectedValue) 

But.... when using Rad controls, how do I get a reference to the "myChartControl" control, and how do I pass the selected value from my RadGrid to the code, so I can use the SelectedValue as a parameter for my chartHelper.GetChartWeb method?

And how do I "delay" invokation of the GetChartWeb method, so the chart is generated on demand when a user clicks the "chart" tab of my tabstrip?

So far very impressed by what's possible with the RadGrid, but growing DEpressed with still being exactly where I was 24hrs ago. Stuck. :-(

Hoping all of this makes sense to someone :-))

J.Jespersen

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 18 Sep 2009, 01:50 PM
Hi Jeppe,

You can access the charting component inside the ItemDataBound server handler of the grid (using the FindControl(id) method of the framework) in order to reference it and pass the selected value from the grid to the GetChartWeb method as a parameter).  For this purpose you can use either the SelectedValue property of the grid or the GetDataKeyValue(fieldName) method for the respective GridDataItem instance.

To load the chart on demand when the grid items are expanded, consider the approach with the hidden panel presented on this demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Soren Michelsen
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or