Completed
Last Updated: 27 Aug 2012 06:03 by ADMIN
ADMIN
Stefan
Created on: 27 Aug 2012 06:03
Category: GridView
Type: Bug Report
1
FIX. RadGridView - missing columns upon data source change
If you have the grid bound to a data source and then you assign another data source containing some of the columns that exists in the first one (with the same name), those columns are not shown:

 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            DataTable table = new DataTable();
            table.Columns.Add("col1");
            table.Columns.Add("col2");
            for (int i = 0; i < 10; i++)
            {
                table.Rows.Add("A " + i, "B " + i);
            }
            radGridView1.DataSource = table;
        }

        private void radButton1_Click(object sender, EventArgs e)
        {

            DataTable table = new DataTable();
            table.Columns.Add("col1");
            table.Columns.Add("col2");
            table.Columns.Add("col3");
            table.Columns.Add("col4");
            for (int i = 0; i < 10; i++)
            {
                table.Rows.Add("Z " + i, "X " + i, "C " + i, "V " + i);
            }
            //work around
            //radGridView1.MasterTemplate.Reset();
            radGridView1.DataSource = table;
        }
    }
0 comments