I'm facing a challenge with adding a CssClass to a table that is generated automatically through C#. The table creation code looks like this:
TableHeaderRow header = new TableHeaderRow();
cell1 = new TableCell { Text = "Brand" };
cell2 = new TableCell { Text = "Product Name" };
cell3 = new TableCell { Text = "Size/Weight" };
cell4 = new TableCell { Text = "Quantity" };
cell5 = new TableCell { Text = "" };
header.Cells.Add(cell1);
header.Cells.Add(cell2);
header.Cells.Add(cell3);
header.Cells.Add(cell4);
header.Cells.Add(cell5);
I've made two attempts to add CssClass to cell3 and cell4:
header.Cells(cell3).CssClass = "mobile2";
header.Cells(cell4).CssClass = "mobile1";
However, I encountered build errors CS1955 and CS1503. It seems like the method I'm using to assign CssClass is incorrect. What could be the issue with this approach?