Hi,
With the help of the posts in http://www.telerik.com/community/forums/aspnet/grid/72051-radgrid-print.aspx#1532370 I could print the entire contents of radgrid in Internet Explorer and mozilla .But I am not able to print the radgrid of certain web pages of the application in same version of mozilla while able to do that in internet explorer.For those pages, the below function PrintRadGrid returns null for $find(radGridId).
For the non-working pages , if i put a alert as the first line of the function PrintRadGrid , then it is working
Could any body please explain why this happens and how to make it working ...
function getOuterHTML(obj) {
if (typeof (obj.outerHTML) == "undefined") {
var divWrapper = document.createElement("div");
var copyOb = obj.cloneNode(true);
divWrapper.appendChild(copyOb);
return divWrapper.innerHTML
}
else
return obj.outerHTML;
}
function PrintRadGrid(radGridId) {
var radGrid = $find(radGridId);
var previewWnd = window.open('about:blank', '', '', false);
var sh = '<%# ClientScript.GetWebResourceUrl(grdName.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",grdName.Skin)) %>';
var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link></head>";
var htmlcontent = styleStr + "<body>" + getOuterHTML(radGrid.get_element().parentNode) + "</body></html>";
previewWnd.document.open();
previewWnd.document.write(htmlcontent);
previewWnd.document.close();
previewWnd.print();
previewWnd.close();
radGrid.get_masterTableView().fireCommand("EnablePaging", "");
}
And in code behind
RadPnl.ResponseScripts.Add("PrintRadGrid('" + grdNmae.ClientID + "')");
Thanks