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 = "<font color='red'>Facility : </font>" + p.Facility;
tbl.Rows[0].Cells.Add(new HtmlTableCell("th"));
tbl.Rows[0].Cells[1].ColSpan = 2;
tbl.Rows[0].Cells[1].InnerHtml = "<font color='red'>Action : </font>" + 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.

Recommended Answers

All 4 Replies

how to add the space between this two tables..

Add this to your CSS file:

table {
  margin-bottom: 10px // or whatever spacing works for you
}

...or:

Response.Write("<br />");

...at the bottom of the loop.

Thank you soo much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.