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

Get the radchart control placed inside the Gridtemplatecolumn of Radgrid

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 07 Oct 2011, 11:02 AM

Hii...
I'm using the Radchart inside the radgrid Gridtemplate column.
 I need to handle some code in tha Rachart_databound event. But in that event I'm not able to get the radchart since it placed in the radgrid.
Please help me in how t

<telerik:RadGrid ID="dispatcherGrd" runat="server" CssClass="gridView1" GridLines="None"
                                          AutoGenerateColumns="false" OnItemDataBound="dispatcherGrd_ItemDataBound" ShowHeader="false"
                                          Width="99%" Height="102px" BorderColor="White" BorderWidth="0" OnPreRender="dispatcherGrd_PreRender"
                                          OnItemCommand="dispatcherGrd_ItemCommand">
                                          <ClientSettings>
                                              <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" />
                                          </ClientSettings>
                                          <AlternatingItemStyle BackColor="White" />
                                          <HeaderStyle HorizontalAlign="Left" />
                                          <ItemStyle Font-Names="Arial" Font-Size="12px" ForeColor="#000000"/>
                                          <MasterTableView>
                                              <Columns>
                                                  <telerik:GridBoundColumn DataField="DispatcherName" HeaderStyle-Width="150px" HeaderText="Dispatcher Name">
                                                  </telerik:GridBoundColumn>
                                                  <telerik:GridBoundColumn DataField="RegularCount" HeaderStyle-Width="90px" HeaderText="Regular">
                                                  </telerik:GridBoundColumn>
                                                  <telerik:GridBoundColumn DataField="EmergencyCount" HeaderStyle-Width="90px" HeaderText="Emergency">
                                                  </telerik:GridBoundColumn>
                                                  <telerik:GridBoundColumn DataField="DirectCount" HeaderStyle-Width="90px" HeaderText="Directed">
                                                  </telerik:GridBoundColumn>
                                                  <telerik:GridBoundColumn DataField="TotalCount" HeaderStyle-Width="90px" HeaderText="Total">
                                                  </telerik:GridBoundColumn>
                                                  <telerik:GridTemplateColumn DataField="" UniqueName="chartcolumn">
                                                      <ItemTemplate>
                                                          <telerik:RadChart ID="dispatcherChrt" runat="server" Width="230px" Style="margin-top: 0px;"
                                                              SeriesOrientation="Horizontal" ChartTitle-Visible="false" SkinsOverrideStyles="true"
                                                              CreateImageMap="false">
                                                              <Series>
                                                                  <telerik:ChartSeries Type="StackedBar">
                                                                      <Appearance BarWidthPercent="85" LabelAppearance-Visible="false">
                                                                          <FillStyle FillType="Solid" MainColor="ForestGreen">
                                                                          </FillStyle>
                                                                      </Appearance>
                                                                  </telerik:ChartSeries>
                                                                  <telerik:ChartSeries Type="StackedBar">
                                                                      <Appearance BarWidthPercent="85" LabelAppearance-Visible="false">
                                                                          <FillStyle MainColor="#f2180d" FillType="Solid">
                                                                          </FillStyle>
                                                                      </Appearance>
                                                                  </telerik:ChartSeries>
                                                              </Series>
                                                              <PlotArea Appearance-Dimensions-Margins="0,0,0,0" Appearance-Border-Color="White"
                                                                  XAxis-Appearance-MajorGridLines-Visible="false" YAxis-Appearance-MajorGridLines-Visible="false"
                                                                  Appearance-FillStyle-MainColor="White" Appearance-FillStyle-FillType="Solid"
                                                                  Appearance-Border-Width="2" />
                                                              <Legend Visible="false"></Legend>
                                                          </telerik:RadChart>
                                                      </ItemTemplate>
                                                  </telerik:GridTemplateColumn>
                                              </Columns>
                                          </MasterTableView>
                                      </telerik:RadGrid>

o get the radchart which has placed inside the Gridtemplate column obj in radchart_databound event.

2 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 10 Oct 2011, 03:47 AM
Hi Ram,

You can attach the DataBound event declaratively. Then in code behind, cast the sender to RadChart, for instance:
protected void radchart_databound(object sender, EventArgs e)
{
    RadChart chart = sender as RadChart;
}


Greetings,
Iana Tsolova
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
Ram
Top achievements
Rank 1
answered on 10 Oct 2011, 07:39 AM
Thanks.
It working.
Tags
Grid
Asked by
Ram
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Ram
Top achievements
Rank 1
Share this question
or