3

I have a Radgrid with few columns. In functiongv_OnItemDataBound I want to iterate over every cell and change text style to bold. I know how to do it when I know the unique name of column:

GridDataItem dataBoundItem = e.Item as GridDataItem;
TableCell tc = dataBoundItem["_Unique_Name"];
tc.Font.Bold = true;

But I'd like to just change font style for whole row without really having to access each cell by name. Is it possible? PS: I do this change only for certain rows so I don't want to change it to bold in aspx file.

KaroCodes
  • 246
  • 2
  • 13

1 Answers1

2

You already know how to get your GridDataItem. So, since you were successful in initializing dataBoundItem, nothing stops you from using dataBoundItem.DataCells, which is an IList property. From there on, you will be able to iterate that property, knowing that Count is the number of elements.

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
  • 1
    I just used `dataBoundItem.Cells` but it worked, thanks! – KaroCodes Apr 21 '17 at 15:08
  • 1
    @eiKatte Cells is a member of ArtOfTest.WebAii.Controls.HtmlControls.HtmlTableRow, while DataCells is a member of Telerik.WebAii.Controls.Html.GridDataItem. Telerik.WebAii.Controls.Html.GridDataItem is inherited from ArtOfTest.WebAii.Controls.HtmlControls.HtmlTableRow, so both approaches should work. – Lajos Arpad Apr 21 '17 at 15:53