“””””””””””””””””””””””””””””””

<script language=”javascript” type=”text/javascript”>
function getconfirm()
{
return confirm(‘Are you sure you want to change the Folio No?’);
}
function Button1_onclick() {
//open new window set the height and width =0,set windows position at bottom
var a = window.open (”,”, ‘ left = ‘ + screen.width + ‘,top=’ + screen.height + ‘,width=0,height=0,toolbar=0,scrollbars=0,status=0’);
//write gridview data into newly open window

//major change here get innerHTML Of the Div

a.document.write(document.getElementById(‘innerData’).innerHTML);
a.document.close();
a.focus();
//call print
a.print();
a.close();
return false;
}

function IMG1_onclick() {
return Button1_onclick()
}

</script>

“””””””””””””””””””””””””””””””

Here the gridview must be placed in a DIV Tag
===================================

<div id=”innerHTML”>

Place Gridview Control here

</div>

<asp:ImageButton ID=”ImageButton1″ ImageUrl=”~/images/Printer-512×512.png” Width=30 Height=30 runat=”server” OnClientClick=”return Button1_onclick()” />

Advertisement