ASP.NET - blank space with user control - Asked By mostafa hamdy on 15-Nov-11 07:29 AM

Hello all
I have some user control which contains more than one image control , and I created some properties for every image to be allowed to be visible or hidden, but when I drage the user control and hidde some image or more in it, I find big blank space between the images and if the shown images for example 2 the blank is becomes begger the code I created is as the following:
the ascx.cs file



bool btnAdd, btnEdit, btnhelp,btndelete,btnnew;



protected void Page_Load(object sender, EventArgs e)

{




if (!IsPostBack)

{

SetEnableProprtties();



}

}




public

bool AddShow

{


get { return btnAdd; }

set { btnAdd = value; }

}


public bool EditShow

{


get { return btnEdit; }

set { btnEdit = value; }

}


public bool HelpShow

{


get { return btnhelp; }

set { btnhelp = value; }

}


public bool NewShow

{


get { return btnnew; }

set { btnnew = value; }

}


public bool DeleteShow

{


get { return btndelete; }

set { btndelete = value; }

}


public void SetEnableProprtties()

{

ImageButton1.Visible = AddShow;

ImageButton2.Visible = EditShow;

ImageButton3.Visible = DeleteShow;

ImageButton4.Visible = HelpShow;

ImageButton5.Visible = NewShow;

}


the ascx file:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestControl.ascx.cs" Inherits="TestControl" %>

<

table>

<

tr>

<

td>

<

asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/add.gif" />

</

td>

<

td>

<

asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/edit.gif" />

</

td>

<

td>

<

asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/images/delete.gif" />

</

td>

<

td>

<

asp:ImageButton ID="ImageButton4" runat="server" ImageUrl="~/images/help.gif" />

</

td>

<

td>

<

asp:ImageButton ID="ImageButton5" runat="server" ImageUrl="~/images/new.gif" />

</

td>

</

tr>

</

table>

please if any body get what I mean and can help me in solving this problem please send me or tell me about some URL may help me in doing that
Regards
Mostafa
Suchit shah replied to mostafa hamdy on 15-Nov-11 07:52 AM
set the width and hegiht of the table ... mostly that will solve your issue... because here you have not defined the table width and height... also set the cell spacing and cell padding property of the table
dipa ahuja replied to mostafa hamdy on 15-Nov-11 01:08 PM
Change the table properties this way

  <table border="1" cellpadding="0" cellspacing="0" id="t1">
  <tr><td valign="top">
  Image1
  </td></tr>
  
  <tr><td valign="top">
  Image2
  </td></tr>
 
  <tr><td valign="top">
  Image3
  </td></tr>
  </table>

trisha baker replied to dipa ahuja on 15-Nov-11 09:52 PM
no idea actually