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

RadTextBoxElement databinding

1 Answer 151 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 2
Michael asked on 03 Apr 2009, 12:01 AM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Victor
Telerik team
answered on 03 Apr 2009, 03:24 PM
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.
Tags
TextBox
Asked by
Michael
Top achievements
Rank 2
Answers by
Victor
Telerik team
Share this question
or