Click here to Skip to main content
14,426,851 members
Rate this:
Please Sign up or sign in to vote.
In windows application I use the following javascript code to print a datagridview 'gvuserinfo'.
The form runs without error but I could not see the 'print' button. The same javascript code with web page works fine. How to solve this?

public MaterialsToBeReadyReport()
con.ConnectionString = Constring;
webBrowser1.DocumentText =
<script type='text/javascript'>
function PrintGridData() {
var prtGrid = document.getElementById('<%=gvUserInfo.ClientID %>');
prtGrid.border = 0;
var prtwin ='', 'PrintGridViewData', 'left=100,top=100,width=500,height=500,tollbar=0,scrollbars=1,status=0,resizable=1');

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You cannot use JavaScript code in windows forms - at least not directly.
You can run JavaScript in an html control.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,078
Richard MacCutchan 1,729
phil.o 1,260
Patrice T 1,187
MadMyche 1,015

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100