Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: I have a table that I want striped. I am creating the table in the aspx file and filling from c# code behind the scenes. The background does not flow to the last cell in each row.

LucyB free asked 3 years ago


    </div>

c# code creating the last cell private TableCell BuildApprovalCell(int Document_ID, int counter) { DataTable dtApprovals = Utilities.Documents.GetExistingDocumentApprovalRoles(dbCmd, Document_ID); // for reference: SELECT xDocs.Document_ID, xDocs.Role_ID, xDocs.UserLogin, FirstName, LastName, r.Role, d.ProductLine, ApprovalStatus, ApprovalDate TableCell tc = new TableCell(); string thisText = ""; Label lbl = new Label(); foreach (DataRow row in dtApprovals.AsEnumerable()) { string sStatus = row["ApprovalStatus"].ToString(); sStatus = (sStatus.Length == 0 ? "Not Approved" : row["ApprovalStatus"].ToString()); thisText = thisText + row["FirstName"].ToString() + " " + row["LastName"].ToString() + " - " + row["Role"].ToString().Replace(" "," ") + " - " + sStatus + "
"; tc.Controls.Add(lbl); } thisText = "" + thisText + ""; lbl.Text = thisText;

        return tc;
    }

Mikołaj Smoleński staff commented 3 years ago

Unfortunately, I can't help with the code sent. Please prepare a snippet that will show us the problem.

Keep coding,  Mikołaj from MDB


LucyB free answered 3 years ago


LucyB free answered 3 years ago


view source on the page -

https://mdbootstrap.com/snippets/standard/lucyb/3219752


Mikołaj Smoleński staff commented 3 years ago

The code is written very badly in many respects. Here's a nice snippet with correct syntax: https://mdbootstrap.com/snippets/standard/ascensus/3177437

To make it striped you just need to add table-striped class to the table element.

Keep coding,  Mikołaj from MDB


LucyB free answered 3 years ago


Screen shot of table results

enter image description here

Code as Written:

    </div>


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: windows pc
  • Browser: chrome & ie
  • OS: windows 10
  • Provided sample code: No
  • Provided link: No