Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

825 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