hi
Just like what we have a Print Preview option in WinForms,I need to open a Print Preview page from UltraWebGird, is it possible ..
regards
winnie
WebGrid doesn't have its own printing methods. Instead, you should use the printing and print-preview functionality of the browser, either from the appropriate menu options or by calling JavaScript functions such as "window.print()".I suggest that you look at the "printing friendly" option that WebGrid has. Otherwise, the page that you print will look exactly as it does on the screen - with scrollbars, if your screen is showing scrollbars. Turning on the "printing friendly" mode disables all JavaScript for the grid and sends its HTML output such that the result is much nicer for printing.
I tryed this code to print the grid,
---------------------------------------------------------------------------------------------------------------------------------------------
void printButton_Click(object sender, EventArgs e) { _gridControl.Browser = Infragistics.WebUI.UltraWebGrid.BrowserLevel.DownLevel; _gridControl.DisplayLayout.LoadOnDemand = LoadOnDemand.NotSet; _gridControl.DisplayLayout.ReadOnly = ReadOnly.PrintingFriendly; string script = "<script language=javascript> " + " var prtContent = document.getElementById('" + div.ClientID + "'); " + " var WinPrint = window.open(); " + " WinPrint.document.write(prtContent.innerHTML); " + " WinPrint.document.close(); " + " WinPrint.print(); " + " WinPrint.close(); " + "</script> "; this.Parent.Page.RegisterStartupScript("Script", script); }
it show the grid in a new window but if I move the mouse over the new window I get a Javascript error on this event
onmousemove='igtbl_cellMouseMove(event,"wpmxwp986637087xTabControlxxctl2xGridControl");
I think that when i set the grid to printfriendly all the javascript are disabled
?
Roberto12cr said:I think that when i set the grid to printfriendly all the javascript are disabled
That said, I don't expect an exception to be thrown on mouse movement. When set for printer-friendly output, the grid should not be hooking up any of its client-side events, even the internal ones.
Using server-side code to register JavaScript to open a new window for your printer-friendly results may itself be the cause of this issue. I recommend using either a dedicated "printer-friendly" page, or use a query-string option on your existing page to specify using printer-friendly options.
i'm als facing the same prob... after printing method s called, the functionality of Ultrawebgrid is not working. pls suggest me way to solve this..
Thanks a lot Vince, that was of great help!
-- Anuj