Click here to Skip to main content
16,020,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Respected sir
i made a website in asp.net, c#, Database is used sql-2005. Data is stored successfully in database. we display this data in the datalist control. But problem arises when we print this form into specific area.
ex. Label format(A4 (3*6 Label format or )).
Posted
Comments
Sandeep Mewara 24-Mar-11 9:24am    
What problem? Please complete your question.
Sunasara Imdadhusen 25-Mar-11 3:36am    
Not clear!!

1 solution

you insert the datalist in panel which name is Panel1

Now you write this java script in this page.
 <script language="JavaScript">
function printTable()
{
var printContent = document.getElementById("Panel1");
var windowUrl = 'about:blank';
var num;
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(num, windowName, 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
</script>

you insert one html button and write this code
<input id="Button1" type="button" value="Print Bill" onclick="printTable()" />


i hope work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900