I am trying to create a form that has a calendar control, dropdownbox, button and Gridview. I want to print the gridview that I populate after I populate the grdiview.
I searched the web and found some examples using ClientScript.RegisterStartupScript. I was able to get it working in IE but when I tested my code in Safari, the PrintManager did not pop up.
Then I replaced the Gridview with a a ReportViewer and Designed a report using the ReportWizard. It worked find in IE but again when I tested in Safari I discovered that the RepportViewer's print icon will not appear in Safari.
My question: If you had to print from a simple webform -- say just the gridview -- how would you go about doing it.
Public Shared Sub PrintWebControl(ByVal ctrl As Control, ByVal Script As String) 'dim StringBuilder sb = new StringBuilder() Dim sb As StringBuilder = New StringBuilder() Dim stringWrite As IO.StringWriter = New IO.StringWriter(sb) Dim htmlWrite As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(stringWrite) If TypeOf ctrl Is WebControl Then Dim w As Unit = New Unit(100, UnitType.Percentage) CType(ctrl, WebControl).Width = w End If Dim pg As Page = New Page() pg.EnableEventValidation = False pg.EnableViewState = False pg.MaintainScrollPositionOnPostBack = False If Script <> String.Empty Then pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script) End If Dim frm As HtmlForm = New HtmlForm() pg.Controls.Add(frm) frm.Attributes.Add("runat", "server") frm.Controls.Add(ctrl) pg.DesignerInitialize() pg.RenderControl(htmlWrite) Dim strHTML As String = stringWrite.ToString() HttpContext.Current.Response.Clear() HttpContext.Current.Response.Write(strHTML) HttpContext.Current.Response.Write("<script>window.print();</script>") HttpContext.Current.Response.End() End Sub
I get the error at line: pg.RenderControl(htmlWrite);
I tried setting the Enable Event Validation to false on the page but that didnt work..
How to print the GridView headings in each page, in case the gridview returns about 100 records and we wish to print all of those, with page heading in each page.
using above code i am able to print gridview directly without hidden fields.after added to hiddenfields to gridview , hiddenfield values are visible for printing.after i am using gridview.colums[i].visible=false column not visible while printingproblem is after print the gridview not visible whatever my columns set visible false.Example:at printing time i am set checkbox visible false, after printing i want reload same page with checkbox but check box not visible after printing gridview
I'm developing an application in which user can decide if he wants to print something now or at some other time. So the idea is for user to click print and say now or determine the time when the document will be printed (without any further user inputs). I don't know what is the best way in asp.net mvc to this. Is there any way to print html in this way or do i have to convert that html in some other format and save it in database?
I have a gridview within an updatepanel which allows paging and has a linkbutton that when clicked shows a modalpopup for editing records. This works fine in IE, Firefox, and Opera but I do not get a postback in Chrome or Safari?? I have other linkbuttons on the page that are within updatepanels but are not within gridviews that are working fine. I have scowered the web but cannot find a solution.
I am using a css stylesheet in one of my web pages. The styles work perfect for Mozilla and IE 7 and below. However theres a problem with it in IE8 and safari.
The width of class in the css is 700px. I have used a contentplaceholder in the master page from where this web page inherits. Now in IE8 it displays a little less than 700px. I think it displays a width of 600px. How can I solve this problem? Is there a tool for IE 8 similar to Firebug?
EDITED: I have figured exactly where the problem is by debugging the page source and the css. I dont know how I can change the width and alignment for ONLY IE8
I have fixed it for IE8 but having issues with Mac Safari. Anyway to target ONLY safari?
Does anybody have experience using ModalPopup extender in iPhone/Safari? I added a ModalPopup and when I click on the button it does not run my server side code. I am sure that I did everything correctly and the same code works just fine in IE and Chrome. Here is a chunk of the code:
[Code]....
andProtected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
I am using .Net 1.1 for development of a web site. I have buttons for next and Back navigation in my user control. I have added this user control to my .aspx page. The navigation works fine in IE and FireFox, but the event does not get called for Safari and Google Chrome browsers.
The text on my website is skewed and different areas are running together when viewing my site on a Mac using either Firefox or Safari. Is there anything I can do about this?