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

RadSpinEditor DataBinding Problem

3 Answers 121 Views
SpinEditor
This is a migrated thread and some comments may be shown as answers.
Shulla Krous
Top achievements
Rank 1
Shulla Krous asked on 02 Mar 2011, 09:16 AM

Hello,

In our application we use RadSpinEditor with binding.

Now we notice a problem with the binding of the control:

When we update the control by the keyboard, then leave the control by tab, returning to the spinEditor and updating another value, the new value does'nt save – when leaving the control the last value returns.

Looking forward to your reply.        


Here is a sample code:

 

static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
    public class Form1 : Form
    {
        List<Class1> l = new List<Class1>();
        public Form1()
        {
            InitializeComponent();
            l.Add(new Class1());
        }
  
        private void Form1_Load(object sender, EventArgs e)
        {
            this.radSpinEditor1.DataBindings.Add("Value", l, "Number");
        }
  
        #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.radSpinEditor1 = new Telerik.WinControls.UI.RadSpinEditor();
            this.button1 = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.radSpinEditor1)).BeginInit();
            this.SuspendLayout();
            // 
            // radSpinEditor1
            // 
            this.radSpinEditor1.Location = new System.Drawing.Point(77, 39);
            this.radSpinEditor1.Name = "radSpinEditor1";
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(90, 86);
            this.button1.Name = "button1";
            this.button1.Text = "button1";
            // 
            // Form1
            // 
            this.ClientSize = new System.Drawing.Size(262, 121);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.radSpinEditor1);
            this.Load += new System.EventHandler(this.Form1_Load);
            ((System.ComponentModel.ISupportInitialize)(this.radSpinEditor1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
  
        }
  
        #endregion
  
        private Telerik.WinControls.UI.RadSpinEditor radSpinEditor1;
        private System.Windows.Forms.Button button1;
    }
  
    class Class1
    {
        int number;
  
        public int Number
        {
            get { return number; }
            set { number = value; }
        }
    }

 

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 07 Mar 2011, 11:26 AM
Hello Naama,

 
Thank you for contacting us.

I was able to reproduce the described behavior. You can work around it by calling the SpinElement's Validate method on SpinEditor LostFocus event.

Copy Code
this.radSpinEditor1.LostFocus += new EventHandler(radSpinEditor1_LostFocus);
     
  
void radSpinEditor1_LostFocus(object sender, EventArgs e)
{
       this.radSpinEditor1.SpinElement.Validate();
}

Please refer to the modified project. Do not hesitate to contact us if you have other questions.

 

Regards,
Peter
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Blas
Top achievements
Rank 2
answered on 27 Oct 2011, 04:51 PM
Hello

I had the same problem, and this workaround has solved it.

Are there any plan to solve this issue in a future release?

Regards
Roberto
0
Peter
Telerik team
answered on 31 Oct 2011, 10:03 AM
Hello Roberto,

Yes, we will provide this functionality in our upcoming release.

Regards,
Peter
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

Tags
SpinEditor
Asked by
Shulla Krous
Top achievements
Rank 1
Answers by
Peter
Telerik team
Blas
Top achievements
Rank 2
Share this question
or