954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Space between two tables.. in loop statement

Hi everyone..

Problem: no space between each tables.Could anyone please advice..
solutions:

here is the coding:
protected void btnShow_Click(object sender, EventArgs e) {
if (ddlMonth.Text != "") {d.Controls.Clear();
DateTime start = DateTime.Parse(ddlMonth.SelectedValue);
DateTime end = start.AddMonths(1).Subtract(new TimeSpan(1, 0, 0, 0));

switch (ddlRecurr.Text) {
#region Daily
case "Daily":{
foreach (preventive p in sdc.preventives.Where(a => a.Site == Session["site"].ToString() && a.Recurrence =="Daily")) {
HtmlTable tbl = new HtmlTable();
tbl.Attributes["style"] = "border-collapse:collapse;border:1px solid black";
tbl.Attributes["frame"] = "box";
tbl.Attributes["rules"] = "all";
tbl.Attributes["class"] = "report";
tbl.Rows.Add(new HtmlTableRow());
tbl.Rows[0].Cells.Add(new HtmlTableCell("th"));
tbl.Rows[0].Cells[0].ColSpan = 2;
tbl.Rows[0].Cells[0].InnerHtml = "Facility : " + p.Facility;
tbl.Rows[0].Cells.Add(new HtmlTableCell("th"));
tbl.Rows[0].Cells[1].ColSpan = 2;
tbl.Rows[0].Cells[1].InnerHtml = "Action : " + p.Activity;


tbl.Rows.Add(new HtmlTableRow());
tbl.Rows[1].Cells.Add(new HtmlTableCell("th")); tbl.Rows[1].Cells[0].InnerText = "Date Due";
tbl.Rows[1].Cells.Add(new HtmlTableCell("th")); tbl.Rows[1].Cells[1].InnerText = "Date Done";
tbl.Rows[1].Cells.Add(new HtmlTableCell("th")); tbl.Rows[1].Cells[2].InnerText = "SME";
tbl.Rows[1].Cells.Add(new HtmlTableCell("th")); tbl.Rows[1].Cells[3].InnerText = "Remark";

foreach (preventiveRecord pr in p.preventiveRecords.Where(a => a.Date_Due >= start && a.Date_Due <= end).OrderBy(a => a.Date_Due)) {
tbl.Rows.Add(new HtmlTableRow());
tbl.Rows[tbl.Rows.Count - 1].Cells.Add(new HtmlTableCell()); tbl.Rows[tbl.Rows.Count - 1].Cells[0].Align = "Right";
tbl.Rows[tbl.Rows.Count - 1].Cells[0].InnerText = pr.Date_Due.Value.ToString("ddd d MMM yyyy");
tbl.Rows[tbl.Rows.Count - 1].Cells.Add(new HtmlTableCell()); tbl.Rows[tbl.Rows.Count - 1].Cells[1].Align = "Right";

if (pr.Date_Done != null) tbl.Rows[tbl.Rows.Count - 1].Cells[1].InnerText = pr.Date_Done.Value.ToString("ddd d MMM yyyy");
tbl.Rows[tbl.Rows.Count - 1].Cells.Add(new HtmlTableCell()); if (pr.SME != null) tbl.Rows[tbl.Rows.Count - 1].Cells[2].InnerText = pr.SME;
tbl.Rows[tbl.Rows.Count - 1].Cells.Add(new HtmlTableCell()); if (pr.Status != null) tbl.Rows[tbl.Rows.Count - 1].Cells[3].InnerText = pr.Status;

and so on..


Thanks and regards.

Attachments Untitled.png 24.21KB
uva1102
Light Poster
40 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

how to add the space between this two tables..

uva1102
Light Poster
40 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

Add this to your CSS file:

table {
  margin-bottom: 10px // or whatever spacing works for you
}
hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 167
 

...or:

Response.Write("");

...at the bottom of the loop.

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

Thank you soo much.

uva1102
Light Poster
40 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: