My client has a ASP.NET (SharePoint) intranet which contains a page that contains a gridview with a column that contains linkbutton.
Now on screen this looks fine, but when they print that page, the linkbutton looks like this:
FieldValue (javascript:WebForm_DoPostBackWithOptions
(new WebForm_PostBackOptions("ctl00$SPWebPartManager1
$g_01343441_bee8_4bd4_a7da_ee1e235a9042$ctl00
$gvDisassemblingHeaders$ctl02$lbDetails2", "", true, "", "",
false, true)))
This script html for this page looks like this and of course it contains that javascript as well.
<tr>
<td>
<a id="ctl00_SPWebPartManager1_g_a37c8367_3bc3_4599_88b9_2df6c9c1dce1_ctl00_gvPrices_ctl06_lbDetails2" title="FieldValue" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$SPWebPartManager1$g_a37c8367_3bc3_4599_88b9_2df6c9c1dce1$ctl00$gvPrices$ctl06$lbDetails2", "", true, "", "", false, true))">FieldValue</a>
</td>
<td>217,3 mm</td>
<td><span id="ctl00_SPWebPartManager1_g_a37c8367_3bc3_4599_88b9_2df6c9c1dce1_ctl00_gvPrices_ctl06_lblAmount">€ 181,97</span>
</td>
<td>8-12-2011</td>
Of course we only want to see the FieldValue other columns and not all the JavaScript behind that button. Any ideas?
I waited a while hoping for a better answer, but none appeared. So we fixed it by adding all columns that contain linkbuttons twice, with css classes that hide/show the columns while on screen/printing. By now i’m quite convinced that this is the way to do it, although it’s quite a bit of work. I don’t think that there is a way to fix this with scripting.