views:

176

answers:

6

I hope this isn't too difficult, obviously you can call HTML tags such as fieldset, label and legends and also textboxes. However how does one call an asp:textbox, i have tried just textbox, asp:textbox, input.textbox but nothing seems to work. This is something that should be really straight forward to do and I can't waste any more time figuring it out.

Thanks.

+2  A: 

You can try input[type=text] but that will not work in IE6. Or you can create a class like .asp-textbox and set the CSSClass property of the textbox to asp-textbox which will work across browsers.

Example:

<asp:TextBox ID="TextBox1" runat="server" CssClass="asp-textbox"></asp:TextBox>

/*CSS*/
.asp-textbox{background-color:red;}
Jon
Hello, thanks I see and understand exactly what you did there.
mw
No problem, glad I could help!
Jon
+1  A: 

it's an input (of type text)

it renders as <input type="text" />

Steffen
+2  A: 

Understand that all of the ASP processing is done on the server, before anything gets to the user. When the user's browser is applying stylesheets, it doesn't see any of your ASP code — all it has is the HTML that's been generated by your ASP code.

So what you're trying to find out is what HTML is generated by the textbox tag. The answer is: it depends on the way the textbox is defined. If the TextMode attribute is set to "multiline", then it's rendered in HTML as a textarea element. If it's set to "password", then it's rendered as an input element of type "password". Otherwise, it's an input element of type "text".

Your best bet is probably to assign a class to your textboxes and reference that in your stylesheet.

Syntactic
+1  A: 

The only cross browser way is to add a class to the textbox using CSSClass property and style that using the class. Also you can use the id selector. When using the id selector check for naming container also.

.test { }

<asp:textbox id="txt1" CssClass="test" runat="server" />
rahul
A: 

If I've understood you correctly, change the word "call" to "select", it's what CSS does (selects and element for styling). Use the property CssClass on the asp:Text in order to make it easily available to your CSS. Example:

.myClass { color: red; }

Simeon
A: 

.myclass td.col1 input { background-color: #D1FFC1; } and if works, in IE also