I'm facing an issue with formatting the output (string) retrieved from a C# database connected to ASP.NET. I want to style the row["Grens"]
differently from row["Sanctie"]
, for instance.
The result is displayed in a basic div:
<div id="resultaat" runat="server"></div>
Here's what I attempted to do, but it didn't work:
public string ShowBoundariesByKeyword(string keyword)
{
string resultList ="";
foreach (DataTable table in _persistcode.SearchBoundariesByKeyword("%" + keyword + "%").Tables)
{
foreach (DataRow row in table.Rows)
{
resultList += "<span class='t1'>" + row["Grens"].ToString() + ": "+"</span>" + "<span class='t2'>"+row["Sanctie"].ToString() + "<br>" + "This belongs in category: " + row["IDCategories"].ToString() + "</span>";
}
}
return resultList;
}
Currently, my CSS code looks like this:
.t1{
font-size: 30px;
color:white;
}
.t2{
font-size: 18px;
color:white;
}