Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A neat little UI trick to change the color of changed Te
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00719469
Message ID:
00720308
Views:
14
The fnRemoveStyle was there in case you needed to revert the color back to "normal". In your case you wouldn't need it but I thought I would include it in case others did.

>Cathi,
>
>I rolled your styles into my CSS and put the CssClass to the .Normal style. Seems to work on all of my ASP.NET textboxes, although it underlines the onChange setting in the control on my aspx page.
>
>I've been trying to pay attention to your and Bonnie's suggestions as I move foward, thanks for the help.
>
>Doug
>
>PS What event would you have call fnRemoveStyle()? I found no need for it, but this was perhaps because I am using just ASP.NET controls?
>
>>Try this in the client code:
>>
>>
>><HTML>
>><HEAD>
>><STYLE>
>>.normal {background-color: #FFFFFF;}
>>.changed {background-color: "#AAAAFF";}
>></STYLE>
>>
>><SCRIPT>
>>function fnSetStyle(object){
>> object.className = "changed";
>>}
>>function fnRemoveStyle(object){
>> object.className = "normal";
>>}
>></SCRIPT>
>>
>>
>>And the textboxt tag add the CLASS and OnChange:
>>
>>
>><INPUT TYPE="text" CLASS="normal" onChange="fnSetStyle(this)" NAME="oInput">
>>
>>
>>>All,
>>>
>>>I just thought this was interesting:
>>>
>>>In your InitializeComponent:
>>>
>>>this.myTextBox.TextChanged += new System.EventHandler(this.TextBox_Changed);
>>>
>>>
>>>The event to process:
>>>
>>>private void TextBox_TextChanged(object sender, System.EventArgs e)
>>>{
>>>     ((TextBox)sender).ForeColor = System.Drawing.Color.Red;
>>>}
>>>
>>>
>>>Pretty Simple. Note this does not change the color until after the page has been posted.
>>>Is there a cute way to do this so that the control could generate the JS necessary to do this in RealTime?
>>>
>>>Doug
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform