views:

1040

answers:

3

Hi, I need to strikeout the entire text(even the whitespace between text/cells) in a row in the RowDataBound event of the GridView. Is it possible?

+1  A: 

Yes, you can put all your rows cell's content into <strike> tag. Example,

row.Cell[0].Text = "<strike>cell content from row.DataItem</strike>";

But it will only strike text in the cells. If you have cellpadding and cellspacing set to the row's table, then it might now look nice.

Sachin Gaur
This just strikes out the text in the cell, i want to strikeout the entire row, even the whitespace between text/cells.
renegadeMind
Those whitespace are there because of cellspacing, cellpadding, or margin applied to table. Send your HTML snippet of GridView, if possible.
Sachin Gaur
+3  A: 

C#

on RowDataBound event

e.Row.Style.Value = "text-decoration:line-through;"

this is how your GridView will be rendered, it works !

<table>
<tr style="text-decoration:line-through;">
<td>some text</td>
<td>some text</td>
</tr>
<tr style="text-decoration:line-through;">
<td>some text</td>
<td>some text</td>
</tr>
<tr style="text-decoration:line-through;">
<td>some text</td>
<td>some text</td>
</tr>
</table>
roman m
didn't work for me, maybe some other style is overriding it, am not sure.
renegadeMind
you can use firebug to see if styles get overridden, but since this style is inline, it should have the priority
roman m
i can see the style being applied for the row using developer toolbar, but it just doesn't seen to work!!
renegadeMind
Thanks for the effort, but this still wont strikeout the entire text(even the white space between text/cells) in the row.
renegadeMind
I've also tried this - e.Row.Font.Strikeout = true; but even this doesn't work!
renegadeMind
the only way to "strike out the white space between the cells" is to have TEXT (in form of  ) in it. you can also try applying a background image to the row with a line through the middle to mimic the empty space strikeout.
roman m
A: 

can any one help me out with the answer

darshan