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

GridViewCheckBoxColumn unchecks on horizontal scroll

3 Answers 79 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jes
Top achievements
Rank 1
Jes asked on 09 May 2012, 04:56 PM
I have a GridView with a databound GridViewCheckBoxColumn.  When the checkbox is checked and I scroll horizontally where the checkbox is no longer visible and then scroll back, the checkbox loses its checked state, though the data source still indicates it should be checked.

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 09 May 2012, 05:26 PM
Hello Jes, 

I haven't been able to replicate your issue. Are you doing some sort of formatting on the row or the cell that might be affecting this? 

In the meantime, here is a sample to try out. 

Designer
namespace RadControlsWinFormsApp1
{
    partial class RadForm1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.radGridView1 = new Telerik.WinControls.UI.RadGridView();
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            this.SuspendLayout();
            //
            // radGridView1
            //
            this.radGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.radGridView1.Location = new System.Drawing.Point(0, 0);
            this.radGridView1.Name = "radGridView1";
            this.radGridView1.Size = new System.Drawing.Size(135, 383);
            this.radGridView1.TabIndex = 0;
            this.radGridView1.Text = "radGridView1";
            //
            // RadForm1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(135, 383);
            this.Controls.Add(this.radGridView1);
            this.Name = "RadForm1";
            //
            //
            //
            this.RootElement.ApplyShapeToControl = true;
            this.Text = "RadForm1";
            this.ThemeName = "ControlDefault";
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion
 
        private Telerik.WinControls.UI.RadGridView radGridView1;
 
 
 
    }
}

Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using System.Linq;
 
namespace RadControlsWinFormsApp1
{
    public partial class RadForm1 : Telerik.WinControls.UI.RadForm
    {
        public RadForm1()
        {
            InitializeComponent();
 
            List<User> users = new List<User>();
            int k = 0;
            while (k <= 20)
            {
                bool hasBeard = (k % 2 == 0);
                users.Add(new User(k, "User " + k.ToString(), hasBeard));
                k++;
            }
 
            this.radGridView1.DataSource = users;
        }
 
    }
 
    public class User
    {
        public User(int id, string name, bool hasBeard)
        {
            Id = id;
            Name = name;
            HasBeard = hasBeard;
        }
 
        public User()
        { }
 
        public int Id
        {
            get;
            set;
        }
 
        public string Name
        {
            get;
            set;
        }
 
        public bool HasBeard
        {
            get;
            set;
        }
    }
 
}

Hope that helps
Richard
0
Stefan
Telerik team
answered on 14 May 2012, 12:04 PM
Hello Jes,

I am not aware of such issues either. Could you please provide us with your application code so we can investigate it and provide you with a solution for this case.  As Richard mentioned, it is most likely that some formatting code causes this issue.

I am looking forward to hearing from you.

All the best,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Jes
Top achievements
Rank 1
answered on 14 May 2012, 04:24 PM
I fixed this by making the column in the data source a type of bool.
Tags
GridView
Asked by
Jes
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Stefan
Telerik team
Jes
Top achievements
Rank 1
Share this question
or