Calling Javascript in C# -


how call following javascript in c# linkbutton_click event. following code on aspx page , want call codebehind

<script type="text/javascript">     function printpanel() {         var panel = document.getelementbyid("<%=pnlcontents.clientid %>");         var printwindow = window.open('', '', 'height=1000,width=900');         printwindow.document.write('<html><head>');         printwindow.document.write('</head><body >');         printwindow.document.write(panel.innerhtml);         printwindow.document.write('</body></html>');         printwindow.document.close();         settimeout(function () {             printwindow.print();          }, 500);         return false;     } </script> 

add linkbutton_click

type mytype = this.gettype(); //you may not need if statement if (!clientscript.isclientscriptblockregistered(sometype, "_linkbutton_click")) {     string script = "printpanel;";     clientscript.registerclientscriptblock(sometype, "_linkbutton_click", script, true); } 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -