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

Template Postback not happening

1 Answer 79 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Baatezu
Top achievements
Rank 2
Baatezu asked on 08 Dec 2008, 07:14 PM
I have added templates at runtime to my menu and that works fine.
The template includes a RadTextBox that I want to do a postback on TextChanged.
in the InstantiateIn function I have
                radTextBox.TextChanged += new EventHandler(radTextBox_TextChanged); 
This works the first time it is called. Subsequent changes to the text cause a postback, but it does not seem that the TextChanged function is called.
            void radTextBox_TextChanged(object sender, EventArgs e) 
            { 
                RadTextBox target = (RadTextBox)sender; 
                if (target.BackColor == System.Drawing.Color.Red || target.BackColor == System.Drawing.Color.Green) 
                { 
                    target.BackColor = System.Drawing.Color.Green; 
                } 
                else 
                { 
                    target.BackColor = System.Drawing.Color.Red; 
                } 
            } 
The backcolor of the RadTextBox starts as white, turns red on a postback and doesn't change again when I change the text more.

I'm pretty lost on what to try to get the text changed to call properly more than the first time. Any pointers would be greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Baatezu
Top achievements
Rank 2
answered on 08 Dec 2008, 07:27 PM
OK - It was happening, I think there is an order of events issue that the red backcolor wasn't getting re-set before the textchanged function was getting called. I modified it to check for specific texts (yellow/blue/ect) and it changes to those each time.
Tags
Menu
Asked by
Baatezu
Top achievements
Rank 2
Answers by
Baatezu
Top achievements
Rank 2
Share this question
or