RadTextBoxElement databinding

2 posts, 1 answers
  1. Michael
    Michael avatar
    33 posts
    Member since:
    Mar 2009

    Posted 02 Apr 2009 Link to this post

    Can a RadTextBoxElement be data bound?

    The following code successfully binds a RadTextBox to a data field:

            class MyObject 
            { 
                public double Number { getset; } 
                public string Title { getset; } 
            } 
     
            public Form1() 
            { 
                MyObject myObject = new MyObject() { Number = 5, Title = "Hello" }; 
                RadTextBox textBox = new RadTextBox(); 
                textBox.DataBindings.Add(new Binding("Text", myObject, "Title")); 
                Controls.Add(textBox); 
            } 

    However, the following code fails to bind a RadTextBoxElement to the same data field:

            class MyObject 
            { 
                public double Number { getset; } 
                public string Title { getset; } 
            } 
     
            public Form1() 
            { 
                MyObject myObject = new MyObject() { Number = 5, Title = "Hello" }; 
                RadTextBoxElement textBox = new RadTextBoxElement() { MinSize = new Size(200, 0) }; 
                textBox.DataBindings.Add(new Binding("Text", myObject, "Title")); 
     
                RadPanel elementsContainer = new RadPanel(); 
                elementsContainer.PanelElement.Children.Add(textBox); 
                Controls.Add(elementsContainer); 
            } 

    Is databinding supported on a RadTextBoxElement?  If so, am I doing it wrong?

    Thanks,
    Michael Hewitt
    Precision Software Design, LLC
  2. Answer
    Victor
    Admin
    Victor avatar
    1351 posts

    Posted 03 Apr 2009 Link to this post

    Hi Michael,

    Thank you for writing.
    Thank you for pointing this out, there seems to be an issue with simple binding in RadTextBoxElement and has been scheduled for fixing.

    Please write back if you have other questions.

    All the best,
    Victor
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top