Is there any way to change the color of the textbox which is defined as required in model. The color should appear when the page load not when the submit button is hit and anything fails.
I need this without assigning any extra class or id in the view. Is there any such property?
Thanks in advance.
you should put this rule on your css file :
input[type=text][data-val-required]{color:red /* or any other color */}
Note: IE7 and IE8 support attribute selectors only if a !DOCTYPE is specified
for more info https://developer.mozilla.org/en-US/docs/CSS/Attribute_selectors
Related
Simply put, I have a JavaFX Textfield that I wish to 1) change the text color on, and 2) change it back to that specified in CSS. Does anyone know how to (generally) access css colors etc. from within the JavaFX code?
AnyFxElement.setStyle(String elementCss);
For source of all the css capabilities I reccomend looking up caspian css.
To remove a style use the code:
// remove the background color on the button
yourElement.setStyle(null);
To set it back to it's default style:
// set the button style back to the default class
yourElement.setStyle(".yourStyle");
Where can I find the aspNetDisabled class default properties system color values? A ddl/select control background property is not "grayed" out when ddl.Enabled=false. For aesthetic purposes I want it to look similar to other disabled controls.
I can change the background of a DDL in the css with:
Select.aspNetDisabled
{
background-color:ScrollBar;
}
Setting all background colors to the same value like this:
.aspNetDisabled
{
background-color:ScrollBar;
}
[surprisingly but makes sense now] is not a solution. Radio buttons and checkboxes have more than its "input area" grayed since the background for them consists of more than an input area. A rb becomes a grayed out square with a grayed out circle. I have tried ever possible SYSTEM COLOR that is available in VS2010 style builder color picker and none of them match. I can view the source and get the color there, but a hard coded value will not necessarily be identical on different machines. I like the default functionality of the aspNetDisabled class and only need to override the background for ddl's.
The aspNetDisabled deafult grayed out system color is "ButtonFace [in .css and buttonface from source]! I wrote a Javascript function to get the background color of a disabled TextBox. I tried the same code yesterday, but failed because of browser specific Javascript functions.
Chrome did not like the property string I was passing to currentStyle[] - received an undefined property error:
var txtBx = $get('<%=txtBx.ClientID %>');
var prop = "background-color"; //also tried backColor and many other variations
strValue = txtBx.currentStyle[prop];
alert("strValue" + strValue);
The getComputedStyle method worked, but of course that is not what I wanted. I ran the same Javascript using ie and was able to get the currentStyle[prop] value.
aspNetDisabled is simply a variable for a class/.css. It would be nice to be able to see its values. I searched the Framework and the "net" yesterday for any related .css files/classes and for the string "aspNetDisabled". The only matches I encountered were aspNetDisabled in WebControls.cs and a WebAdminStyle.css under the 4.0 dir. I also tried to use the debugger, but could not find the style properties for "txtBX" as I expanded each layer.
I guess writing Javascript a function to loop through all properties for each type of "disabled" control would accomplish that. There is probably a way to write a .net class to find all properties and their values of a .css class too.
It is unclear to me why the background color of a DDL does not get modified when disabled...
I hope this helps someone!
We have a huge ASP.Net web application in C#. It is now required that the fontcolor of the text in disabled textboxes be changed. The problem is that most of the textboxes have the "disabled" attribute set and not "readonly". If I change the attribute to "readonly", i will have to modify all the places in the javascript code where checks like
if(document.getElementByID('Element1').disabled == 'true') etc exist. And these checks exists at 1000s of places. If start changing all these i will be trapped in a downward spiral, moving away from humanity, disapperaing into an abyss never from which i may be able to come out. Please help me on this.
I should add that i need it to work only for IE8. Thanks.
The following worked for me:
input[disabled] {
background-color: GrayText !important;
color: White !important;
}
Unfortunately, you can not change font color of disabled text box in IE8.
Is there a simple way to change the default colors of controls in asp.net (VS2010). Specifically, every time a textbox is moused over or a submit button is clicked, they get light blue highlights or borders. This was fine until I made a light green site. Now it really does not match at all. Is there one simple place in VS2010 I can change this default color to green?
Thanks for any help....and yes I'm a noob!
Use CSS
If you're using a master page, just setup a default styles css file in the master page and set all of your css styles there, such as input, p, a, input[type="submit"], etc.
If you're not using a master page, define these in the .aspx pages
Here's a link to a CSS tutorial: http://www.w3schools.com/css/
If you don't provide CSS information for the controls in either a stylesheet, style tag or inline styles, then they will use the CSS as defined by the browser that you are using.
With that out of the way, you can style your controls in CSS based on their type:
input { ... }
input[type="text"] { ... }
input[type="submit"] { ... }
I am using asp.net 3.5 and C#.
I want to change my mouse cursor similar to this site
http://dummyblogtrix.blogspot.com/
How can I do the same ?
Please help.
Thanks in advance
Don't. Just Don't.
Or set the cursor style on the body tag.
In order to set a 'special' non-windows icon, you have to reference a URL to a cursor icon (.cur).
body
{
cursor:url(customCursor.cur);
}
However, I highly recommend you do not set a custom cursor. It will only serve to annoy users.
I do believe this will cause all other pointers to be overridden. I.e. your anchor tags would also use the custom icon. If you wanted to keep the standard icon, you'd have to set the cursor on all the other standard html tags, i.e.:
a
{
cursor:pointer;
}
Use the CSS cursor attribute
CSS Cursor
W3C