RadSpinEditor DataBinding Problem

4 posts, 0 answers
  1. Shulla Krous
    Shulla Krous avatar
    13 posts
    Member since:
    Oct 2009

    Posted 02 Mar 2011 Link to this post

    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; }
            }
        }

     

  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 07 Mar 2011 Link to this post

    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!
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Blas
    Blas avatar
    55 posts
    Member since:
    Dec 2007

    Posted 27 Oct 2011 Link to this post

    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
  5. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 31 Oct 2011 Link to this post

    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.

Back to Top