Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 30, 2012 02:22 PM by res.web
Contributor
2864 Points
1125 Posts
Apr 30, 2012 02:06 PM|LINK
This is not really important to my site, as I could live without it, but I wan't to add a feature to my forms.
I currently have textbox css for standard, hover, and focus
but what I would like to do upon validation is change the style of the textbox where there is an error.
How would I detect which Validation events have been activated and then change the textbox for that event, say required field.
2066 Points
416 Posts
Apr 30, 2012 02:10 PM|LINK
Maybe this thread can be helpful
http://forums.asp.net/p/1415769/3120520.aspx
Regards
Member
546 Points
138 Posts
Apr 30, 2012 02:14 PM|LINK
Hi,
You can set some flag.When it goes inside validation function and find that textbox doesnot contain valid data then set that flag to false.
Now use if condition to see whether that flag is false if yes then chage its css properties in code by using Add Attributes method
Let me know whether it works
All-Star
41188 Points
6034 Posts
Apr 30, 2012 02:19 PM|LINK
Bobby-Z How would I detect which Validation events have been activated and then change the textbox for that event, say required field.
May be this helps you..
http://www.vijaykodali.com/Blog/post/2008/06/05/Change-back-ground-color-of-Aspnet-Textbox-on-validation-failure.aspx
Apr 30, 2012 02:22 PM|LINK
will you please post some code so that i can find it
Bobby-Z
Contributor
2864 Points
1125 Posts
Detect Validation and change Textbox CSS
Apr 30, 2012 02:06 PM|LINK
This is not really important to my site, as I could live without it, but I wan't to add a feature to my forms.
I currently have textbox css for standard, hover, and focus
but what I would like to do upon validation is change the style of the textbox where there is an error.
How would I detect which Validation events have been activated and then change the textbox for that event, say required field.
Currently Learning: ASP, SQL, CSS, JavaScript, AJAX, XML, XSLT, C# So please be patient with me! Thanks
Gaspard
Contributor
2066 Points
416 Posts
Re: Detect Validation and change Textbox CSS
Apr 30, 2012 02:10 PM|LINK
Maybe this thread can be helpful
http://forums.asp.net/p/1415769/3120520.aspx
Regards
res.web
Member
546 Points
138 Posts
Re: Detect Validation and change Textbox CSS
Apr 30, 2012 02:14 PM|LINK
Hi,
You can set some flag.When it goes inside validation function and find that textbox doesnot contain valid data then set that flag to false.
Now use if condition to see whether that flag is false if yes then chage its css properties in code by using Add Attributes method
Let me know whether it works
budugu
All-Star
41188 Points
6034 Posts
Re: Detect Validation and change Textbox CSS
Apr 30, 2012 02:19 PM|LINK
May be this helps you..
http://www.vijaykodali.com/Blog/post/2008/06/05/Change-back-ground-color-of-Aspnet-Textbox-on-validation-failure.aspx
"Don't be afraid to be wrong; otherwise you'll never be right."
res.web
Member
546 Points
138 Posts
Re: Detect Validation and change Textbox CSS
Apr 30, 2012 02:22 PM|LINK
will you please post some code so that i can find it