0

I have a table with rows where i have a number in every row. I want this number of rows must be with font-style: bold

This is my code :

DataTable table = new DataTable();
table.Columns.Add("Route");

int counter = 1;
foreach (SPListItem item in myItemColForTable)
{
    DataRow row = table.NewRow();
    row["Route"] = counter.ToString() + ". " + item["Route"].ToString();
    counter ++;
}

DataView mydataview = new DataView(table);
table = mydataview.ToTable(true, "Route");
myGrid.DataSource = table;
myGrid.DataBind();

I want this string -->

counter.ToString() + ". "

must be with bold style.

Furkan Ekinci
  • 2,472
  • 3
  • 29
  • 39
Gohyu
  • 468
  • 2
  • 10
  • 32

1 Answers1

1

Well you could pull out the text and replace it with a span with the bold option turned on.

Example :

void Item_Bound(Object sender, DataGridItemEventArgs e)
{
    string yourSubString = "some string to bold";
    e.Item.Cells[0].Text = e.Item.Cells[0].Text.Replace(yourSubString,
        string.Format("<span style='font-weight: bold'>{0}</span>", yourSubString));

}
Ruban J
  • 622
  • 1
  • 7
  • 31