change border of asp:textbox with stylesheet

M

moondaddy

I want to change the border of a asp.net textbox to thin-solid-blue but when
I set the cssclass property to a class in the stylesheet, the border
properties in the stylesheet don't have any effect on the textbox's
appearance. however if I write a style attribute into the textbox tag like
the sample below the border looks like I want:
style="BORDER-RIGHT:steelblue 1px solid; BORDER-TOP:steelblue 1px solid;
BORDER-LEFT:steelblue 1px solid; WIDTH:202px; BORDER-BOTTOM:steelblue 1px
solid"

How can I achieve this by just using the stylesheet?

Here's the class in the stylesheet:
clsLgnTxBx
{
border-right: steelblue 1px solid;
border-top: steelblue 1px solid;
border-left: steelblue 1px solid;
border-bottom: steelblue 1px solid;
}
 
M

moondaddy

Thanks Steven. That must have sounded like a dumb question and I appreciate
all the work you put into your responses!!! I did in fact use the CssClass
attribute and not the Class attribute but for some reason it wasn't taking
effect. Well I had a lot going on yesterday in this project and it looks
like something got jammed up in VS or somewhere else because when I rebooted
this morning the asp.net textboxes were recognizing the style and had the
appearance I was trying to achieve. I don't know why it started working
after the reboot, but, I guess its just one of those things... meanwhile it
made me look pretty silly. Sorry :(
 
S

Steven Cheng[MSFT]

Hi Moondaddy,


Thanks for your followup. I'm glad that you've figured out the problem. I
think what you've met is likely caused by the client's cache since you used
a static css link file. So I recomment that you try refresh the client
browsr's cache when you meet the similar problem. Anyway, thanks again for
posting in community.



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
M

moondaddy

Thanks, but now can you tell me how to get a dropdown list and a checkbox to
have similar appearance? It seems that the dropdown list doesn't have a
border property to set.
 
S

Steven Cheng[MSFT]

Hi Moondaddy,

Thanks for your followup. As you mentioned the border style of the
DropDownList and CheckBox control, they're actually
mapped to the "<Select... >" and <input type="checkbox" ... > html element.
And the <select> element (dropdownlist) dosn't have border propety, so we
can't manually set it and its appearance only depend on the client's OS
version, for example, the appearnce on a XP machine is different from on a
WIN2K server.
As for the checkbox(<input type="checkbox") we can set its border as
<input type="checkbox" id="chkTest" runat="server"
style="BORDER-RIGHT:green 5px double; BORDER-TOP:green 5px double;
BORDER-LEFT:green 5px double; COLOR:#5b5c56; BORDER-BOTTOM:green 5px
double; BACKGROUND-COLOR:yellow" ...>

But the appearnce may still different on different client according to the
OS version.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
R

Ravichandran J.V.

"clsLgnTxBx
{
border-right: steelblue 1px solid;
border-top: steelblue 1px solid;
border-left: steelblue 1px solid;
border-bottom: steelblue 1px solid;
}"

Substitute the above code with a dot prefix.

.clsLgnTxBx
{
border-right: steelblue 1px solid;
border-top: steelblue 1px solid;
border-left: steelblue 1px solid;
border-bottom: steelblue 1px solid;
}

Then, assign the Style sheet to the textbox with the CSS property.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top