Q: How to eliminate selection rectangle on ImageButton?

T

Tyrant Mikey

I don't know if this can even be done, but I'd REALLY like to eliminate
the selection rectangle that appears around my ImageButton controls
when the user clicks on them. The buttons are on a black background,
and the selection rectangle looks like complete crap.
Any suggestions are greatly appreciated!!

Thanks!
 
T

teknohippy

I don't know if this can even be done, but I'd REALLY like to eliminate
the selection rectangle that appears around my ImageButton controls
when the user clicks on them. The buttons are on a black background,
and the selection rectangle looks like complete crap.
Any suggestions are greatly appreciated!!

Thanks!

Do you have a URL example to look at?

I
 
T

Tyrant Mikey

No, I don't have a sample, really. What I've got, though is pretty
straightforward.

I have an ASP.NET page. There's an ImageButton control on it, with a
Windows bitmap loaded into it (the images contain text, and they look
much better as BMPs then JPGs or GIFs). The images are are rounded
buttons, set against a black background. The page looks great, right up
until the user clicks on the button. At that point, the focus rectangle
appears on the control, and ruins the visual consistency of my page (a
white dotted rectangle forms around a capsule-shaped button).

What I'd like to do is hide the selection/focus rectangle on the image
buttons if possible.

If it can't be done, I'll just have to accept that. But it sure would
be nice to be able to get rid of it.
 
K

Ken Cox [Microsoft MVP]

That looks like something the browser puts on the screen when the control
has the focus.
 
M

MWells

If there is a way to suppress the focus, it will most likely be part of CSS.
I'd hunt there first, especially the IE-specific CSS documentation as there
may be a custom attribute for this.

Meanwhile, while googling on "disable focus rectangle css", I stumbled
across this;
http://www.faqts.com/knowledge_base/view.phtml/aid/5693/fid/53
It seems to be a javascript approach to your problem.

Also see;
http://nowhere.2entwine.com/archives/000127.html
http://www.webdesignforums.net/archive/index.php/t-4728.html
http://www.projectseven.com/extensions/info/remscrub/

/// M
 
T

Tyrant Mikey

Oila!!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<!-- SNIPPED! -->
</HEAD>
<BODY ms_positioning="GridLayout">
<!-- Smart Navigation and ViewState snipped! -->
<form name="Form1" method="post" action="defaultpage.aspx" id="Form1"
__smartNavEnabled="true">
<!-- Smart Navigation and ViewState snipped! -->
<!-- Other webcontrols on the page snipped! -->
<input type="image" name="btnProceed" id="btnProceed"
src="images/button_proceed.bmp" alt="" border="0" style="Z-INDEX: 106;
LEFT: 336px; POSITION: absolute; TOP: 472px" />
</form>
</BODY>
</HTML>
 
A

alanl2

Tyrant said:
*I don't know if this can even be done, but I'd REALLY like to
eliminate
the selection rectangle that appears around my ImageButton controls
when the user clicks on them. The buttons are on a black background,
and the selection rectangle looks like complete crap.
Any suggestions are greatly appreciated!!

Thanks! *

Hey Tyrant,
Have you found a fix for this yet. I strugled with the same thing for a
couple of hours before I tried this.

MyImageButton.Attributes.Add("onFocus", "this.blur();")

I have this in the page load event of my vb code behind page, works
great!
Good Luck
Alan
 
T

Tyrant Mikey

Nope, I hadn't found a fix for it yet. But I will give this a try. I
wonder if it interferes with the postback...

Thanks for the tip!
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top