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

Is telerik suppor the Forums?Please reply me ASAP.......Telerik Admin Solve My problem

13 Answers 142 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SANNIDHI
Top achievements
Rank 1
SANNIDHI asked on 15 Jul 2009, 10:41 AM
c



SANNIDHI   
 Posted on Jul 11   
 

I posted this post on Jul11 there is no reply..


IS telerik will supprt Export to PDf in Multicolumn Headers??????????????????????

No support Say NO?????????????? okkkkkkkkkkkkk
Hi,  
 
     I want to export to pdf in TelerikGrid.I am using follwing code  
 
< 
 
   
 
telerik:GridBoundColumn DataField="Partner Name" UniqueName="PartnerName" HeaderText="PartnerName"   
 
   
 
 
   
 
HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="left">   
 
   
 
 
   
 
</telerik:GridBoundColumn>   
 
   
 
 
   
 
<telerik:GridBoundColumn DataField="Rank" UniqueName="Rank" HeaderStyle-HorizontalAlign="Center"   
 
   
 
 
   
 
ItemStyle-HorizontalAlign="Right" HeaderText="Rank">   
 
   
 
 
   
 
</telerik:GridBoundColumn>   
 
   
 
 
   
 
<telerik:GridBoundColumn DataField="Rank1" UniqueName="Rank1" HeaderStyle-HorizontalAlign="Center"   
 
   
 
 
   
 
ItemStyle-HorizontalAlign="Right" HeaderText="Rank1">   
 
   
 
 
   
 
</telerik:GridBoundColumn>   
 
   
 
 
   
 
<telerik:GridTemplateColumn UniqueName="Column1" InitializeTemplatesFirst="true">   
 
   
 
 
   
 
<HeaderTemplate>   
 
   
 
 
   
 
<table id="Tabfy08" cellspacing="0" style="width: 100%;">   
 
   
 
 
   
 
<tr>   
 
   
 
 
   
 
<td colspan="2" align="center">   
 
   
 
 
   
 
<b>COULMNSHEADER</b>   
 
   
 
 
   
 
</td>   
 
   
 
 
   
 
</tr>   
 
   
 
 
   
 
<tr>   
 
   
 
 
   
 
<td style="width: 50%; border-style: none;" align="center">   
 
   
 
 
   
 
<asp:Label ID="lblfy08" Text="Rank" runat="server" />   
 
   
 
 
   
 
</td>   
 
   
 
 
   
 
<td style="width: 50%; border-style: none;" align="center">   
 
   
 
 
   
 
<asp:Label ID="lblesa08" Text="Rank1" runat="server" />   
 
   
 
 
   
 
</td>   
 
   
 
 
   
 
</tr>   
 
   
 
 
   
 
</table>   
 
   
 
 
   
 
</HeaderTemplate>   
 
   
 
 
   
 
<ItemTemplate>   
 
   
 
 
   
 
<table cellspacing="0" width="100%" class="myTable">   
 
   
 
 
   
 
<tr>   
 
   
 
 
   
 
<td style="width: 50%">   
 
   
 
 
<%  
 
# Eval("Rank")%>   
 
   
 
   
 
 
</td>   
 
   
 
 
   
 
<td style="width: 50%">   
 
   
 
 
<%  
 
# Eval(" Rank1")%>   
 
   
 
   
 
 
</td>   
 
   
 
 
   
 
</tr>   
 
   
 
 
   
 
</table>   
 
   
 
 
   
 
</ItemTemplate>   
 
   
 
 
   
 
<ItemStyle HorizontalAlign="Center" />   
 
   
 
 
   
 
</telerik:GridTemplateColumn> 
 
I want to export to pdf which has template columns.  
 
For that i am using following code  
 
 
 
   
 
MYGRID.ExportSettings.ExportOnlyData =   
 
true;   
 
   
 
MYGRID.ExportSettings.IgnorePaging =   
 
 
true;   
 
   
 
MYGRID.ExportSettings.OpenInNewWindow =   
 
 
true;   
 
   
 
 
 
 
MYGRID.MasterTableView.HierarchyDefaultExpanded =   
 
true;   
 
   
 
MYGRID.ExportSettings.ExportOnlyData =   
 
 
true;   
 
   
 
MYGRID.MasterTableView.ExportToPdf();  
 
 
 In Button Click Event...............  
 
But i am not getting the result of template columns in PDF..  
 
Is Telerik Grid Support this????????????????Please Clarify this ASAP..ASAP  
 
Thanks in Advance  
SANNIDHI 

13 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 15 Jul 2009, 04:43 PM
Hello Sannidhi,

Please refer to the following thread:
Link to public post

Best regards,
Daniel
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
SANNIDHI
Top achievements
Rank 1
answered on 16 Jul 2009, 10:05 AM
My Another Question is..

I am using Charts in My Gird...

                  whether I can use different colours...??By default u r showing Green,Blue..........
                    Clarify whether i can use different colours???????????????

                   Please give reply ASAP..

0
Daniel
Telerik team
answered on 16 Jul 2009, 10:47 AM
Hello Saniddhi,

I recommend you examine our online PDF demo that will help you get a better picture of the capabilities of our PDF export engine.
Export to PDF

I'm afraid that exporting RadChart is unsupported scenario.

Let me know if you need more information.

Best regards,
Daniel
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
SANNIDHI
Top achievements
Rank 1
answered on 16 Jul 2009, 05:35 PM
I am not talking about export of chart to pdf..

Let take an example ..I am using Radchart in Mygrid.

                     By Default  i am getting Green,Blue colors right..

                    But i want different colors for My Grid..Can i get it???????????????????????

Reply ASAP..

And

         One More..How to give DataFormat string for GridTemplate column???
0
ManniAT
Top achievements
Rank 2
answered on 16 Jul 2009, 06:15 PM
Hi SANNIDHI,

first of all - my native language is german so please excuse me if I don't understand everting correctly.
I guess ASAP (a phrase you use in every post) means something like RTFM (a phrase I also often read) :)

Anyhow - if you want to change the colors of chart items you have to provide an "appearance" tag.
It took me about 2 minutes reading online help to figure this out.

The example here has blue bars:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandchart/chartingrid/defaultcs.aspx?product=chart
The code for this column is:
<telerik:GridTemplateColumn DataField="CustomerID" UniqueName="ChartColumn" HeaderText="OrdersPerProduct">  
    <ItemTemplate> 
        <telerik:RadChart ID="RadChart1" runat="server" Width="350" Height="170" 
            ChartTitle-Visible="false" DataSourceID="SqlDataSource2" CreateImageMap="false">  
            <Series> 
                <telerik:ChartSeries Name="Orders" DataYColumn="quantity" DataLabelsColumn="pName">  
 
                </telerik:ChartSeries> 
            </Series> 
            <PlotArea Appearance-Dimensions-Margins="10,10,10,10" /> 
            <Legend Visible="false"></Legend> 
        </telerik:RadChart> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 
 
 
Now just add an appearance tag. The result looks (just an example) like this:
<telerik:GridTemplateColumn DataField="CustomerID" UniqueName="ChartColumn" HeaderText="OrdersPerProduct">  
    <ItemTemplate> 
        <telerik:RadChart ID="RadChart1" runat="server" Width="350" Height="170" 
            ChartTitle-Visible="false" DataSourceID="SqlDataSource2" CreateImageMap="false">  
            <Series> 
                <telerik:ChartSeries Name="Orders" DataYColumn="quantity" DataLabelsColumn="pName">  
 
 
                    <Appearance> 
                            <FillStyle FillType="ComplexGradient" MainColor="255, 224, 78">  
                                <FillSettings> 
                                    <ComplexGradient> 
                                        <telerik:GradientElement Color="255, 224, 78" /> 
                                        <telerik:GradientElement Color="247, 204, 22" Position="0.5" /> 
                                        <telerik:GradientElement Color="226, 175, 3" Position="1" /> 
                                    </ComplexGradient> 
                                </FillSettings> 
                            </FillStyle> 
                            <TextAppearance TextProperties-Color="Lime">  
                            </TextAppearance> 
                    </Appearance> 
 
 
                </telerik:ChartSeries> 
            </Series> 
            <PlotArea Appearance-Dimensions-Margins="10,10,10,10" /> 
            <Legend Visible="false"></Legend> 
        </telerik:RadChart> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 
 
That's it - you have now orange bars with lime levels.
Last not least - you can change almost everything on a chart.
Here is an overview about it: http://www.telerik.com/help/aspnet-ajax/stylingelements.html
What I changed (according to this excellent help) was P and R.

HTH

Manfred
0
Bruno
Top achievements
Rank 2
answered on 16 Jul 2009, 09:34 PM
SANNIDHI

It seems that your 'k' and '?' keys are stuck. I strongly recommend you stop eating this sticky strawberry jam over the keyboard. Now to the point...
I will translate for you what the RTFM abbreviation (from ManniAT's answer) means - READ THE FACTUAL DOCUMENTATION. This actually means that it is strongly recommended that you examine the documentation (http://www.telerik.com/help/aspnet-ajax) before asking questions since this will:
- bring you the answer immediately ASAP ASAP
- save the time of the support guys and the forum users like me, ManniAT and the others
- decrease the useless discussions in forums
0
SANNIDHI
Top achievements
Rank 1
answered on 17 Jul 2009, 04:19 AM
Bruno Thank for your suggestion...
But one thing ,...

 I read all the documents...

     What i am asking is.........I know how to change the background colors of...PIE CHART..

You did not understand my question...I want to give different colors to my datacolumn..

For example i want to give..Red for...Column 1 in Radchart..
                                            Balck for Column 2 in Radchart.................Like this....

Anyway thanks for u r suggestion...

But for my question this is not answer,,,


Thanks in Advance
0
ManniAT
Top achievements
Rank 2
answered on 17 Jul 2009, 09:14 AM
Hi SANNIDHI,

sorry - I checked your question - but you did not ask about PIE.
Anyhow it is exactly the same thing as I've shown in my example.
I guess (you wrote background colors) you meant the series colors (he colors of the pie parts).
To ensure I answer you question - I'll change both - the series and the plot background.
I start with the pie chart sample here:
http://demos.telerik.com/aspnet-ajax/chart/examples/skinning/pie/defaultcs.aspx
Again it is (almost) the same as in the first sample I gave above - but now you have multiple ChartSeries
<telerik:RadChart ID="RadChart1" runat="server" SkinsOverrideStyles="true" Width="600px">  
    <PlotArea> 
        <XAxis MaxValue="5" MinValue="1" Step="1">  
        </XAxis> 
        <YAxis MaxValue="25" Step="5">  
        </YAxis> 
        <YAxis2 MaxValue="5" MinValue="1" Step="1">  
        </YAxis2> 
    </PlotArea> 
    <Series> 
        <telerik:ChartSeries Name="Series 1" Type="Pie">  
            <Items> 
                <telerik:ChartSeriesItem YValue="23" Name="Item 1">  
                </telerik:ChartSeriesItem> 
                <telerik:ChartSeriesItem YValue="20" Name="Item 2">  
                </telerik:ChartSeriesItem> 
                <telerik:ChartSeriesItem YValue="24" Name="Item 3">  
                </telerik:ChartSeriesItem> 
                <telerik:ChartSeriesItem YValue="19" Name="Item 4">  
                </telerik:ChartSeriesItem> 
                <telerik:ChartSeriesItem YValue="25" Name="Item 5">  
                </telerik:ChartSeriesItem> 
            </Items> 
        </telerik:ChartSeries> 
    </Series> 
</telerik:RadChart> 
 
Since this sample changes the skin from code behind we have to make a change in the first line of the chart:
<telerik:RadChart ID="RadChart1" runat="server" SkinsOverrideStyles="true" Width="600px">  
IMPORTANT CHANGE SkinOverrideStyles to FALSE  
<telerik:RadChart ID="RadChart1" runat="server" SkinsOverrideStyles="false" Width="600px">  
 
And then - do the same as I showed in my post above. But multiple times (I take different Fills this time to show some possibilities.
<telerik:RadChart ID="RadChart1" runat="server" SkinsOverrideStyles="false" Width="600px">  
        <PlotArea> 
          
            <Appearance> 
            <FillStyle FillType="Solid" MainColor="120, 0, 120" /> 
            </Appearance> 
              
            <XAxis MaxValue="5" MinValue="1" Step="1">  
            </XAxis> 
            <YAxis MaxValue="25" Step="5">  
            </YAxis> 
            <YAxis2 MaxValue="5" MinValue="1" Step="1">  
            </YAxis2> 
        </PlotArea> 
        <Series> 
            <telerik:ChartSeries Name="Series 1" Type="Pie">  
                <Items> 
                    <telerik:ChartSeriesItem YValue="23" Name="Item 1">  
                      
                      
                    <Appearance> 
                        <FillStyle FillType="ComplexGradient" MainColor="255, 224, 78">  
                            <FillSettings> 
                                <ComplexGradient> 
                                    <telerik:GradientElement Color="255, 224, 78" /> 
                                    <telerik:GradientElement Color="247, 204, 22" Position="0.5" /> 
                                    <telerik:GradientElement Color="226, 175, 3" Position="1" /> 
                                </ComplexGradient> 
                            </FillSettings> 
                        </FillStyle> 
                    </Appearance> 
                      
                      
                    </telerik:ChartSeriesItem> 
                    <telerik:ChartSeriesItem YValue="20" Name="Item 2">  
                      
                      
                        <Appearance> 
                            <FillStyle FillType="Solid" MainColor="Red">  
                            </FillStyle> 
                        </Appearance> 
                          
                          
                    </telerik:ChartSeriesItem> 
                    <telerik:ChartSeriesItem YValue="24" Name="Item 3">  
                      
                      
                        <Appearance> 
                            <FillStyle FillType="Hatch" FillSettings-HatchStyle="Cross" MainColor="Red">  
                            </FillStyle> 
                        </Appearance> 
                          
                          
                    </telerik:ChartSeriesItem> 
                    <telerik:ChartSeriesItem YValue="19" Name="Item 4">  
                      
                      
                        <Appearance> 
                            <FillStyle FillType="Gradient" SecondColor="Yellow" MainColor="Lime">  
                            </FillStyle> 
                        </Appearance> 
                          
                          
                    </telerik:ChartSeriesItem> 
                    <telerik:ChartSeriesItem YValue="25" Name="Item 5">  
                    </telerik:ChartSeriesItem> 
                </Items> 
            </telerik:ChartSeries> 
        </Series> 
    </telerik:RadChart> 
 
Notice two things - like in the first sample I optically isolated the additions with blank lines (all of them are appearance blocks).
And notice further the style for the first chart item is exactly the same as in the first sample I gave here.

If this answers your question - please mark the post as an answer (there is a checkbox on the bottom).
############
I saw you have an other question. About DataFormatString.
The general answer - data format strings are the same as if you would call string.Format with the data as parameter.
So (for an example) if you have a DateTime value in the column and want to format it as short data use:
"{0:d}"
Fore TemplateColumns the things are a bit different.
YOU provide Templates (that's the intention of TemplateColumn).
If you provide an item template - it's up to you to format your data.
And you can print everything: data from this column, data from other columns, system values,....
As Sample - I have Grid with schedule data. One field is "Datum" (the date of the element) an other thing is "Dauer" the duration of this element.
To save space I want to combine the output in one column.
It should look like "Date (duration)" - and I want to show only the data (no time) of the event.
<telerik:GridTemplateColumn DataField="Datum" DataType="System.DateTime" HeaderText="Datum" SortExpression="Datum" UniqueName="Datum" HeaderStyle-Width="100px" > 
    <ItemTemplate> 
        <%#((DateTime)Eval("Datum")).ToShortDateString() + " (" + Eval("Dauer") + "h)" %> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 
 
And - that's what Templates are fore - I can even do a more complex look like:
<telerik:GridTemplateColumn DataField="Datum" DataType="System.DateTime" HeaderText="Datum" SortExpression="Datum" UniqueName="Datum" HeaderStyle-Width="100px" > 
    <ItemTemplate> 
        On <%#((DateTime)Eval("Datum")).ToShortDateString()%> you spent <%#Eval("Dauer")%> hours for <%#Eval("Title")%> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 
 
And to make the answer complete - a sample for the use of DataFormatString (on a bound column)
<telerik:GridBoundColumn DataField="LastActivityDate" DataType="System.DateTime" HeaderText="Zul. Aktiv" SortExpression="LastActivityDate" UniqueName="LastActivityDate" AllowFiltering="False" DataFormatString="{0:d}" HeaderStyle-Width="70px" ReadOnly="true">  
</telerik:GridBoundColumn> 
 

HTH

Manfred
0
ManniAT
Top achievements
Rank 2
answered on 20 Jul 2009, 12:18 PM
Hi SANNIDHI,

did any of the answer solve your problems / questions?
If so please set "the mark as answer" - this helps the supporters a lot.
It's the only way to know if:
a.) the problem is solved
OR
b.) someone didn't have time or whatever to check the potential answer.

Regards

Manfred
0
SANNIDHI
Top achievements
Rank 1
answered on 23 Jul 2009, 05:41 PM
Hi ManniAT ,

                            U r Explanation for my questions are excellent.
                            But My Requirement is different......I will put my question in this way....
                            We are always talkinh background color...s
                             Lets take an example...We have pie chart...Pie chart will have different columns..
                              In general we have blue,green....etc only Telerik grid showing 4 colors for Polt area...(I am not talking aboout baackgroundcolor)
                               If i want to see Piechart for more  than 5 columns,
                                    column1-Blue...in PieChart ARea.
                                       column2-Green In Piechartarea.
                              .............................column5-again blue...

                                If i see same color for rwo columns it is not readable...right....
                               I want to see all these columns in One Piechart...One PieChart.................with different colors.....
                               Is telerik support this option???
                               Did u get my question??

Thanks in advance...
Sannidhi
0
ManniAT
Top achievements
Rank 2
answered on 23 Jul 2009, 06:11 PM
Hi SANNIDHI,

I'm not very sure that I got your question.
Please take a look at this sample:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandchart/gridandaggregatechart/defaultcs.aspx?product=chart
Here we have a pie chart.

With my bad eyes I would say:
We have 4 pies in some kind of blue and 3 pies in some kind of green.
I see 3 different "blues" - the data with 55 and 10 use the same color.

We have a gray plotarea.

I think - you want to change the "blues and greens" to different colors?
Am I right?

By the way - this is what the code before did - he changed some of these things to "orange" or other colors.

You wrote
>>  In general we have blue,green....etc only Telerik grid showing 4 colors for Polt area...(I am not talking aboout baackgroundcolor)
Sorry - we have to find a common "naming convention" -- "plot area" is that are where the chart is drawn on (gray in the sample above).
Or marked as *S in this picture:
http://www.telerik.com/help/aspnet-ajax/stylingelements.html


To get a clear situation:
In the linked sample - what do you want to change?
The color of the Plot area (other than gray)?
The color of the segments (the blue and green ones)?
And last not least - what did you mean with "I want to see more than 5 columns"?

Regards

Manfred
0
SANNIDHI
Top achievements
Rank 1
answered on 24 Jul 2009, 12:09 PM
Hi ManniAT,

                         Your Right...They have showing only blue,green colors.
                          If i have 5 columns let take an example.

                         ..I have 5 columns...i want different colors..
      http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandchart/gridandaggregatechart/defaultcs.aspx?product=chart

In above link also ........Let s take chart. for column "CHANG" &"QUESO MANCHEGO LA POSTEORO" ..Both have sam  lightblue color
Right....

But i want two different colors for that.....................

Thanks in advance....
SANNIDHI
0
ManniAT
Top achievements
Rank 2
answered on 24 Jul 2009, 01:14 PM
Hi,

that was exactly what the code above does.
And if you have 5 items - just add 5 series to the code above.

BUT - to stay with the current sample - there a "no items" :)
The markup for the series looks like this:
<Series> 
    <telerik:ChartSeries DataYColumn="spentMoney" Name="spentMoney" Type="Pie">  
        <Appearance LegendDisplayMode="ItemLabels">  
        </Appearance> 
    </telerik:ChartSeries> 
</Series> 
 
So all item look the same. And RadChart chooses the colors random.
If you take a look at the example you willl notice that the "Name" (on the legend is different).
This is set in code behind.
Oposite to my previous example we can have an "unlimited" number of series in this case.
But to set different colors in this case - we must change the colors also in code behind (like the lables).
The sample code looks like this:
 protected void RadChart1_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e)  
        {  
            e.SeriesItem.Name = (string)DataBinder.Eval(e.DataItem, "pName");  
        }  
 
This method gets called for every item. And (at the moment) it sets the "Name" of each item.
This function is also a good place to change the colors.

I decided to use gradients. So first I tell every Item that it has to be gradient filled.
protected void RadChart1_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e) {  
    e.SeriesItem.Name = (string)DataBinder.Eval(e.DataItem, "pName");  
 
    e.SeriesItem.Appearance.FillStyle.FillType = FillType.Gradient;  
}  
 
As seen in the sample above we change the appearance. Above we did it in markup:
<Appearance>    
    <FillStyle FillType="Gradient" SecondColor="Yellow" MainColor="Lime">     
    </FillStyle>    
</Appearance>    
 
And now we will do it in code behind. Notice - the names are the same.
What we are missing now are colors. A main- and a secondcolor for each item.
So we must somehow hold a list of possible colors.
The apporach I took was to create a simple class like this:
private class ColorPairs {  
    #region MainColor  
    private Color m_cMainColor;  
    public Color MainColor {  
        get { return m_cMainColor; }  
        set { m_cMainColor = value; }  
    }  
    #endregion  
 
    #region SecondColor  
    private Color m_cSecondColor;  
    public Color SecondColor {  
        get { return m_cSecondColor; }  
        set { m_cSecondColor = value; }  
    }  
    #endregion  
}  
 
Next we need a list (or something like this) of members from this class.
I decided to write a helper function wich builds and fills the list.
private List<ColorPairs> m_lColors;  
private void GenerateColors() {  
    m_lColors = new List<ColorPairs>();  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Red, SecondColor = Color.Orange });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Yellow, SecondColor = Color.Orange });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Lime, SecondColor = Color.Orange });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Green, SecondColor = Color.Lime });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Navy, SecondColor = Color.SteelBlue });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.SteelBlue, SecondColor = Color.LightSkyBlue });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Blue, SecondColor = Color.Orange });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Coral, SecondColor = Color.Green });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Coral, SecondColor = Color.Green });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Magenta, SecondColor = Color.Magenta }); //easy to see the end is reached :)  
}  
 
The next step is to call this function - but is must be done only once per databinding cycle.
I added a boolen to check this.
private bool bColorsBuilt = false;  //could be done via Session or Application also  
protected void RadChart1_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e) {  
    if (!bColorsBuilt) {  
        GenerateColors();  
    }  
    e.SeriesItem.Name = (string)DataBinder.Eval(e.DataItem, "pName");  
 
    e.SeriesItem.Appearance.FillStyle.FillType = FillType.Gradient;  
 
So - now we are almost done. We only have to find a kind of iteration through the colors in the list.
A simple interger incremented after every assignement will do the job.
And we have to check if it reaches "max" - so that we can set it back to 0 again.
    nCurColorIDX++;  
    if (nCurColorIDX >=m_lColors.Count) {  
        nCurColorIDX = 0;  
    }  
 
Now we are almost finished - we only have to assigne the colors (and set the boolean in the Generate Colors function).
To avaid frequent calls to "m_lColors.Count" I added a helper.
The final code looks like this:
private bool bColorsBuilt = false;  //could be done via holding the color list in Session or Application also  
private int nCurColorIDX = 0;  
private int nMaxColorIDX = 0;  
private List<ColorPairs> m_lColors;  
private void GenerateColors() {  
    m_lColors = new List<ColorPairs>();  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Red, SecondColor = Color.Orange });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Yellow, SecondColor = Color.Orange });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Lime, SecondColor = Color.Orange });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Green, SecondColor = Color.Lime });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Navy, SecondColor = Color.SteelBlue });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.SteelBlue, SecondColor = Color.LightSkyBlue });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Blue, SecondColor = Color.Orange });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Coral, SecondColor = Color.Green });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Coral, SecondColor = Color.Green });  
    m_lColors.Add(new ColorPairs() { MainColor = Color.Magenta, SecondColor = Color.Magenta }); //easy to see the end is reached :)  
    nMaxColorIDX = m_lColors.Count - 1;  
    bColorsBuilt = true;  
}  
 
protected void RadChart1_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e) {  
    if (!bColorsBuilt) {  
        GenerateColors();  
    }  
    e.SeriesItem.Name = (string)DataBinder.Eval(e.DataItem, "pName");  
 
    e.SeriesItem.Appearance.FillStyle.FillType = FillType.Gradient;  
    e.SeriesItem.Appearance.FillStyle.MainColor = m_lColors[nCurColorIDX].MainColor;  
    e.SeriesItem.Appearance.FillStyle.SecondColor = m_lColors[nCurColorIDX].SecondColor;  
    nCurColorIDX++;  
    if (nCurColorIDX > nMaxColorIDX) {  
        nCurColorIDX = 0;  
    }  
}  
 
Two things to notice:
a.) The number of elements in the list should be as great as the number of (max) series you will generate from your data.
---Otherwhise it will start with the first color again
b.) The last color I added (should not be reached) is "worse" - it acts as a signal to see when I reached the limit.

Last not least - a screenshot of the result;
http://www.pp-p.net/images/piechart1.png

I hope this solves your problem / question.

Regards

Manfred

Tags
Grid
Asked by
SANNIDHI
Top achievements
Rank 1
Answers by
Daniel
Telerik team
SANNIDHI
Top achievements
Rank 1
ManniAT
Top achievements
Rank 2
Bruno
Top achievements
Rank 2
Share this question
or