[FONT="]Greetings my fellow Programmers, i am have issues in terms of hiding and element when printing from my index..... I will like to hide the Edit,Delete and Details column when print, but i am not getting it .... Please i need your help and below is my code...[/FONT]
[FONT="]// the part i want to hide[/FONT]
[FONT="]
[/FONT]
[FONT="]// I want to hide this part from printing!!![/FONT]
[FONT="]<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.ActionLink("Edit", "Edit", new { id = item.QalificationtId })|@Html.ActionLink("Details", "Details", new { id = item.QalificationtId })|@Html.ActionLink("Delete", "Delete", new { id = item.QalificationtId })
</td>[/FONT]
[FONT="]
[/FONT]
[FONT="]
[/FONT]
[FONT="]// the full code[/FONT]
[FONT="]<p>
@Html.ActionLink("Add Staff Qualification", "Create")| <a onclick="printDiv('div1')" href="javascript:void(0)">Print</a>
</p>[/FONT]
[FONT="]<div id="div1" style="overflow:scroll; width:100%;">
<table class="table">
<caption class="caption"> Staff Qualification Table </caption>
<thead style=" text-align:center; background-color:#ffffff; border-left:thin; border-right:thin; border-bottom:thin; border-color:aliceblue; border-width:thin; ">[/FONT]
[FONT="]<tr style=" background-color: black; color: white; text-align: center; border-bottom: 1px dashed #999;">[/FONT]
[FONT="]<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]Name of School Attendented
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]Qualification
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]Year
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">
Staff Name
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]Department
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]<th></th>
</tr>[/FONT]
[FONT="]@foreach (var item in Model)
{
<tr style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: black; border-top: 1px dashed #999; border-width:thin; border-left: 1px dashed #999; ">[/FONT]
[FONT="]<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.School)
</td>
<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.Qualification)
</td>
<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.Year)
</td>
<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.Staff.Surname) @Html.DisplayFor(modelItem => item.Staff.Firstname)
</td>
<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.Department.DeptName)
</td>
[/FONT]
[FONT="]// I want to hide this part from printing!!![/FONT]
[FONT="]<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.ActionLink("Edit", "Edit", new { id = item.QalificationtId })|@Html.ActionLink("Details", "Details", new { id = item.QalificationtId })|@Html.ActionLink("Delete", "Delete", new { id = item.QalificationtId })
</td>
</tr>
}[/FONT]
[FONT="]</table>
<script>
function printDiv(printcontent) {
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printcontent).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr + newstr + footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}
</script>
</div>[/FONT]
[FONT="]// the part i want to hide[/FONT]
[FONT="]
[/FONT]
[FONT="]// I want to hide this part from printing!!![/FONT]
[FONT="]<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.ActionLink("Edit", "Edit", new { id = item.QalificationtId })|@Html.ActionLink("Details", "Details", new { id = item.QalificationtId })|@Html.ActionLink("Delete", "Delete", new { id = item.QalificationtId })
</td>[/FONT]
[FONT="]
[/FONT]
[FONT="]
[/FONT]
[FONT="]// the full code[/FONT]
[FONT="]<p>
@Html.ActionLink("Add Staff Qualification", "Create")| <a onclick="printDiv('div1')" href="javascript:void(0)">Print</a>
</p>[/FONT]
[FONT="]<div id="div1" style="overflow:scroll; width:100%;">
<table class="table">
<caption class="caption"> Staff Qualification Table </caption>
<thead style=" text-align:center; background-color:#ffffff; border-left:thin; border-right:thin; border-bottom:thin; border-color:aliceblue; border-width:thin; ">[/FONT]
[FONT="]<tr style=" background-color: black; color: white; text-align: center; border-bottom: 1px dashed #999;">[/FONT]
[FONT="]<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]Name of School Attendented
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]Qualification
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]Year
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">
Staff Name
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]Department
</th>
<th style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]<th></th>
</tr>[/FONT]
[FONT="]@foreach (var item in Model)
{
<tr style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: black; border-top: 1px dashed #999; border-width:thin; border-left: 1px dashed #999; ">[/FONT]
[FONT="]<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.School)
</td>
<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.Qualification)
</td>
<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.Year)
</td>
<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.Staff.Surname) @Html.DisplayFor(modelItem => item.Staff.Firstname)
</td>
<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.DisplayFor(modelItem => item.Department.DeptName)
</td>
[/FONT]
[FONT="]// I want to hide this part from printing!!![/FONT]
[FONT="]<td style="text-align: center; border-bottom: 1px dashed #999; border-right: 1px dashed #999; border-color: white; border-top: 1px dashed #999; border-left: 1px dashed #999; border-width: thin; ">[/FONT]
[FONT="]@Html.ActionLink("Edit", "Edit", new { id = item.QalificationtId })|@Html.ActionLink("Details", "Details", new { id = item.QalificationtId })|@Html.ActionLink("Delete", "Delete", new { id = item.QalificationtId })
</td>
</tr>
}[/FONT]
[FONT="]</table>
<script>
function printDiv(printcontent) {
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printcontent).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr + newstr + footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}
</script>
</div>[/FONT]