to print datagrid control in asp.net 2k3
-
I am making a keyword research tool for my website where the keyword info and the similar displayed in datagrid controls. i want to print or save the data in datagrid control only, not the whole page. I know the javascript command to print the whole page window.print() .But i have to print the datagrid control oany. can somebody tell me... u can visit my url at: http://inabrains.com/keyword_research.aspx[^]
-
I am making a keyword research tool for my website where the keyword info and the similar displayed in datagrid controls. i want to print or save the data in datagrid control only, not the whole page. I know the javascript command to print the whole page window.print() .But i have to print the datagrid control oany. can somebody tell me... u can visit my url at: http://inabrains.com/keyword_research.aspx[^]
Hi raj1984, try this: 1. Add a div tag on your page and give it an ID (ex: divGrid) 2. Add your datagrid control into the div. 3. Add an button and write to onclick event, which will open a new blank page. 4. Add all HTML tag in divGrid to the new page. ex:
<div id='divGrid'> <asp:DataGrid.... </div> <input type='button' onclick.='doPrint();'>
doPrint method:function doPrint() { var subwin = window.open("_blank"); // you can open an existing page var d = document.getElementById("divGrid"); subwin.document.write(d.innerHTML); subwin.print(); }