Solved

How to add blank spaces between controls when adding them at run-time

Posted on 2004-08-07
2
682 Views
Last Modified: 2011-08-18
The following code adds a bunch of image buttons to a placeholder.   The problem is that they all sit right next to each other.   What can I use to put a small space in between each image button.    
HtmlGenericControl lcBreak = new HtmlGenericControl("br");  <-- this puts each image button on a new line,  but i need them to be listed next to each other.
HtmlGenericControl lcBreak = new HtmlGenericControl("&nbsp;");    <---  this prints   " < > " inbetween each image button..   so that doesn't work either.  

I just want a few spaces in between each image button.   How can I do this?   Thanks


FileList = Directory.GetFiles(Server.MapPath("/images/icon1"));                                    

foreach( string i in FileList)
{

str_data = i.Remove(0,46);
      System.Web.UI.WebControls.ImageButton images  = new System.Web.UI.WebControls.ImageButton();
      .ID =str_data;
      images.ImageUrl = "http://www.web.com/images/" +
            CurrentLevels.SelectedValue + "/" +
            str_data;
      IconPlaceHolder.Controls.Add(images);
      HtmlGenericControl lcBreak = new HtmlGenericControl();
      IconPlaceHolder.Controls.Add(lcBreak);
}
0
Comment
Question by:Arron_S
2 Comments
 
LVL 7

Accepted Solution

by:
mdamico earned 250 total points
ID: 11743653
IconPlaceHolder.Controls.Add(new LiteralControl("&nbsp;"));
0
 

Author Comment

by:Arron_S
ID: 11743735
Friggen Sweet.   I figured it would be something easy like that.  Thanks  
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now