Search code examples
asp.netimagebuttonascx

Custom conrol trouble using ImageButtons Adds Whitespace


I am creating a website and I'm stuck with creating an ascx user control.

I basically want to create a navigation section

enter image description here

and place it in the corner of my pages (people have to be able to click on the buttons).

What I tried was doing this with ImageButtons with transparent background. This was the idea:

enter image description here

but in the designer, i'm getting a whitespace (and that's bad!).

code:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Nav.ascx.cs" Inherits="EpicRocketStudios.Nav" %>

<asp:ImageButton ID="ImageButton1" runat="server" Height="75px" ImageUrl="~/images/home.png" Width="112px" />
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/About.png" />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/images/Forum.png" />
<asp:ImageButton ID="ImageButton4" runat="server" ImageUrl="~/images/Contact.png" />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:ImageButton ID="ImageButton5" runat="server" Height="135px" ImageUrl="~/images/Downloads.png" Width="142px" />

When I drag it to a page, it's even worse!

enter image description here

That is still without css stuff...

Is there a proper way of creating something like this? Or is it just impossible?


Solution

  • Sounds like you want to create an image map. I never used them, but I remember them! I did a little google search and just played around at this site, you may get what you need with it. Or teach yourself