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
2009-02-11 07:31:14
This just strikes out the text in the cell, i want to strikeout the entire row, even the whitespace between text/cells.
renegadeMind
2009-02-11 07:50:25
Those whitespace are there because of cellspacing, cellpadding, or margin applied to table. Send your HTML snippet of GridView, if possible.
Sachin Gaur
2009-02-11 09:13:33
+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
2009-02-11 07:32:38
didn't work for me, maybe some other style is overriding it, am not sure.
renegadeMind
2009-02-11 07:43:15
you can use firebug to see if styles get overridden, but since this style is inline, it should have the priority
roman m
2009-02-11 08:03:27
i can see the style being applied for the row using developer toolbar, but it just doesn't seen to work!!
renegadeMind
2009-02-11 08:19:30
Thanks for the effort, but this still wont strikeout the entire text(even the white space between text/cells) in the row.
renegadeMind
2009-02-11 08:24:28
I've also tried this - e.Row.Font.Strikeout = true; but even this doesn't work!
renegadeMind
2009-02-11 08:26:15
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
2009-02-11 18:01:16