Completed
Last Updated: 15 Jun 2016 07:06 by ADMIN
ADMIN
Dimitrina
Created on: 12 Aug 2015 10:13
Category: GridView
Type: Bug Report
0
Gridview export to excel shows binding errors

		
3 comments
ADMIN
Stefan
Posted on: 03 Nov 2015 14:08
Hello Bernd,

Thank you for the feedback.

I have raised the priority of the item, so that it gets higher in our backlog. We will do our best to fix the issue as soon as possible.

As to your second question, I suggest you opening a new support thread and describe the issue in it.

Thank you for your patience.   

All the best.
Bernd
Posted on: 07 Oct 2015 14:48
I cannot underdtand why DataConverter also not able to solve.
Please solve that probkem quick.
Bernd

Here is the example to reproduce it:


private void AddColumns(RadGridView gv, string[] columnNames)
        {
            for (int i = 0; i < columnNames.Length; i++)
            {
                GridViewDataColumn gridViewDataColumn = new GridViewDataColumn();
                gridViewDataColumn.Header = columnNames[i];
                gridViewDataColumn.Width = 100;

                Binding binding = new Binding(String.Format("[{0}]", i));
                binding.Mode = BindingMode.OneWay;

                if (i == 0)
                {
                    // First column shows only the "Name" of the rows as string.
                    binding.Converter = new ObjectToStringConverter();
                    gridViewDataColumn.DataType = typeof (string);
                }
                else
                {
                    // All other columns will show "double" numbers.
                    binding.Converter = new ObjectToDoubleConverter();
                    gridViewDataColumn.DataType = typeof(double);
                }

                gridViewDataColumn.DataMemberBinding = binding; //new Binding(String.Format("[{0}]", i));
               
                gv.Columns.Add(gridViewDataColumn);
            }
        }
    }

    //---- ValueConverter ----------------

    [ValueConversion(typeof(object), typeof(String))]
    public class ObjectToStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string text = (string)value;
            return text;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            object obj = value;
            return obj;
        }
    }

    [ValueConversion(typeof(object), typeof(double))]
    public class ObjectToDoubleConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double number = (double)value;
            return number;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            object obj = value;
            return obj;
        }
    }


Bernd
Posted on: 07 Oct 2015 14:45
You must fix this.
I cannot believe you guys do nit have a work around.
Put it on high level.
Thx Bernd