Solved

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

Posted on 2004-08-07
2
710 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 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
parsing JSON help 1 26
how to just get time from a date 6 48
Where does legacy ASP.NET initialize language? 2 61
ASP.NET Built-In Report Creator / Viewer 5 23
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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