Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-08-07
2
Medium Priority
?
742 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
mdamico earned 1000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

604 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