private object dgRelativePerformance_PdfElementExporting(int rowIndex, int columnIndex, object columnCollection, object itemCollection)
        {
            IList <GridViewBoundColumnBase> columns = columnCollection as IList <GridViewBoundColumnBase>;
            IList items = itemCollection as IList;

            if (columns == null || items == null)
            {
                return(null);
            }

            object result = columns[columnIndex].GetValueForItem(items[rowIndex]);

            if (columns[columnIndex].DataMemberBinding.Path.Path != null)
            {
                if (columns[columnIndex].DataMemberBinding.Path.Path == "Country Id")
                {
                    RelativePerformanceData data = items[rowIndex] as RelativePerformanceData;
                    if (data != null)
                    {
                        return(data.CountryId);
                    }
                }
                else if (columns[columnIndex].DataMemberBinding.Path.Path
                         .Contains("RelativePerformanceCountrySpecificInfo"))
                {
                    int countrySpecificIndexStartIndex = columns[columnIndex].DataMemberBinding.Path.Path
                                                         .IndexOf('[');
                    int countrySpecificIndex = Convert.ToInt32(columns[columnIndex].DataMemberBinding.Path.Path
                                                               .Substring(countrySpecificIndexStartIndex + 1, columns[columnIndex].DataMemberBinding.Path.Path.Length - countrySpecificIndexStartIndex - 2));
                    RelativePerformanceData data = items[rowIndex] as RelativePerformanceData;
                    if (data != null)
                    {
                        RelativePerformanceCountrySpecificData value = data.RelativePerformanceCountrySpecificInfo[countrySpecificIndex];
                        if (value.Alpha != null)
                        {
                            decimal totalValue = 0M;

                            String formattedValue = Decimal.TryParse(value.Alpha.ToString(), out totalValue) ?
                                                    GetValueInBasisPoints(totalValue.ToString()) : String.Empty;
                            return(formattedValue);
                        }
                    }
                }
                else if (columns[columnIndex].DataMemberBinding.Path.Path == "Total")
                {
                    RelativePerformanceData data = items[rowIndex] as RelativePerformanceData;
                    if (data != null)
                    {
                        decimal totalValue = 0M;

                        string value = Decimal.TryParse(data.AggregateCountryAlpha.ToString(), out totalValue) ?
                                       GetValueInBasisPoints(totalValue.ToString()) : "Total";

                        return(value);
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// handles element exporting for grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgRelativePerformance_ElementExporting(object sender, GridViewElementExportingEventArgs e)
        {
            RadGridView_ElementExport.ElementExporting(e, () =>
            {
                if (e.Value is RelativePerformanceData)
                {
                    RelativePerformanceData value = e.Value as RelativePerformanceData;
                    if (value != null)
                    {
                        decimal totalValue = value.AggregateCountryAlpha.HasValue?
                                             value.AggregateCountryAlpha.Value:0;
                        countryTotal = GetValueInBasisPoints(totalValue.ToString());
                    }

                    return(value);
                }

                if (e.Value is RelativePerformanceCountrySpecificData)
                {
                    RelativePerformanceCountrySpecificData value = e.Value as RelativePerformanceCountrySpecificData;

                    string result = String.Empty;
                    if (value.Alpha != null)
                    {
                        decimal totalValue = 0M;

                        result = Decimal.TryParse(value.Alpha.ToString(), out totalValue) ?
                                 GetValueInBasisPoints(totalValue.ToString()) : String.Empty;
                    }
                    return(result);
                }

                if (e.Value == null)
                {
                    GridViewDataColumn column = (e.Context as GridViewDataColumn);
                    if (column != null)
                    {
                        if ((!String.IsNullOrEmpty(column.Header.ToString()) && String.Equals(column.Header.ToString(), "Total",
                                                                                              StringComparison.CurrentCultureIgnoreCase)))
                        {
                            return(countryTotal);
                        }
                    }
                }

                if (e.Element == ExportElement.FooterCell)
                {
                    decimal totalValue = 0M;

                    string value = Decimal.TryParse(e.Value.ToString(), out totalValue) ?
                                   GetValueInBasisPoints(totalValue.ToString()) : "Total";

                    return(value);
                }

                return(e.Value);
            });
        }