?
Solved

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

Posted on 2004-08-07
2
Medium Priority
?
730 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

741 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