C# - Print Using Javascript By Writing The Content Into A (hidden) IFrame?
Nov 4, 2010
have a asp.net application where I'm trying to load few documents into memory and print it. I learned that I can't use PrintDialog in a web app and the only way is to print using javascript by writing the content into a (hidden) iFrame.My question is how can Silverlight help me with this? Is it possible to show print dialog and get printer settings and print without a preview by sending the files directly to the printer? How hard it is achieve to using SL?
View 1 Replies
Similar Messages:
Apr 28, 2010
I've got a JQuery tabcontrol (4 tabs), which each of them control 1 gridview. now I got a button "print". It activates a javascriptfunction, which should build a page, containing all gridviews. I got something, but it does not work:
function doPrintPage() {
myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=500,height=600');
myWindow.document.open();
myWindow.document.writeln("<link href='/styles/Layout.css' type='text/css' rel='stylesheet' ></link>");
myWindow.document.write(document.getElementById('tabcontainer').innerHTML);
myWindow.document.close();
myWindow.focus();
myWindow.print();
return true;
}
I thought it may be the getElementByID() and then something like 'tabcontainer' (which contains the tabs) or 'tabcontent' (the content of each tab) or 'GridView1' or something, but I could be completely wrong.
View 1 Replies
Mar 4, 2011
I need to print the current page in the asp.net application for that I am using javascript:window.print().
It's working fine when the page content is within the bounds. However, if the horizontal scrollbar appears as a result of overflow, am able to print only the visible content while the overflown contents couldn't be printed.
Is there any workaround to get this working? Is there any other alternative apart from javascript to achieve this functionality?
View 1 Replies
Feb 26, 2010
I'm in a little bit of a bind and have some weird behavior happening with a multiview control behaving differently between two machines, and of course, the production machine is the broken one. The page renders the correct content on both machines, but if I save the html file the production machine's source is wrong.
For example, if for step 1 the output should be just the letter A, and step 2 the output should be just the letter B, and step 3 the output should be the letter C, here is what happens:
Step 1:
Production - The source and output are both the letter A
Dev - the source and output are both the letter A
Step 2:
Production - the source is the letter A and the ouput on the browser is the letter B
Dev - the source and output on the browser are both the letter B
Step 3:
Production - the source is the letter A and the ouput on the browser is the letter C
Dev - the source and output on the browser are both the letter C
Is this some issue with SessionState? I'm very new to Multiviews and by no means an ASP expert.
View 1 Replies
Nov 4, 2010
when showing the modal popup, the iframe on my page covers part of it,what should I do?
View 13 Replies
Feb 9, 2012
I'm using jQuery to build an IFRAME and pass some hidden input values to a Download.aspx page - jQuery code looks like this
Code:
$('<form action="'+ url +'" method="'+ (method||'post') + '" target="iframeX">'+inputs+'</form>')
.appendTo('body').submit().remove();
The inputs variable looks like this
<input type="hidden" name="filename" value="mit-license.txt" />
And the top of the Download.aspx code behind looks like this
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ctx As HttpContext = HttpContext.Current
Dim response As HttpResponse = ctx.Response
Dim sFile As String = "mit-license.txt" ' Request.QueryString("filename").ToString
[Code] ....
I could not find the INPUT value - where does it pass in? I checked the "sender" and the ctx objects and could not find it... I hardwired the mit-license.txt filename to prove that the download works...
View 5 Replies
Oct 13, 2010
Is it possible to change the backround color of a iframe? The default is white..
<iframe id="hdnFrm" name="hdnFrm" src="" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="width:90%; height:70px"></iframe>
View 5 Replies
Mar 21, 2011
I want to print pdf document or iframe from button click event in asp.net. If someone know pdf print or iframe print code in asp.net
View 9 Replies
Jan 6, 2011
Below I have some code that I am using to give the user the option to save or open a file. However, for whatever reason, when it does this it appends everything that is in my .aspx page to the end of my file. I've no clue why this is happening or how to fix.
[Code]....
View 3 Replies
Jun 21, 2011
I am using a third party gateway. The third party gateway does not support query-string , so i will need to post the form to pass the values to the given URL and another thing is that they don't expose the web-services so we need to use their page and that means we need to host it in an iframe in asp.net
so what i did is that i have hidden fields that will be used as parameters as depicted below
Code:
<input type="hidden" name="p1" value='4635' />
<input type="hidden" name="p2" value='Reference_test' />
<input type="hidden" name="p3" value='Purchase credits' />
[Code]..
Now the purpose of this , is to load the iframe after the page load event of the asp.net gets fired.
Now my problem here is that when the iframe loads , it does not pass the parameters to the url that is being set in the iframe.
I have attached the example, project. (2kb)
When you run the project you will notice when the iframe loads there is an Error
"NO VCS ID"
now this means that the parameters were not passed when the Iframe loads , i can understand because it seems like iframe does not do a full form post. so to demonstrate what i want, click the proceed button and you will notice it will give you a page with no errors and it will be a page where credit card details are required , i want to iframe to load that the first time.
View 1 Replies
Mar 3, 2010
I am using an iframe for showing a page in my website. i want to hide that frame using a close button in the content page( the page which is showing in the frame)
How to do this?
View 2 Replies
Mar 15, 2010
I realized that IE8 does not allow links from cross domains to be displayed in IFrame.
It seems like there are only two Header options that Microsoft allows to modify.
X-FRAME-OPTIONS : "DENY" (This does not display any IFrame content )
X-FRAME-OPTIONS : "SAMEORIGIN" (Displays content from the same domain)
Is there a work around to allow content from other domains to be displayed?
View 1 Replies
Jan 30, 2011
Considering that iframes do not resize to dynamic content, I need something that will resize like a table and can be used for dynamic content.
View 2 Replies
May 25, 2010
I am having a content page in master page and an iframe in content page.
In content page i have dynamically created treeview and in iframe i am having a gridview. As i add or delete a row in iframe my treeview should automatically reloaded that value without entire page referesh.
Here point to notice is my iframe is a different aspx .
View 2 Replies
Aug 15, 2010
I have iframe that works at the server side :
<iframe frameborder="0" runat="server" style="width: 100%; height: 700px; background-color: #bacad3;" id="I1" name="I1" src="Page.aspx"></iframe>
and I change the content dynamically with this code :
protected void Button1_Click(object sender, EventArgs e)
{
I1.Attributes["src"] = "Page.aspx";
}
I want to implement it with ajax in the following way:
when user click out side of iframe dont postback page and change the src of iframe .I want to show the progress inside the progressupdatepanel
I mention it I dont want to run any postback just loading page inside the iframe with ajax by calling outside of iframe for example there is a button in the page and it is handled by update panel and it loads the content of other page inside the iframe.
View 2 Replies
Aug 29, 2010
I have an iframe on website A which receives the controls from website B once the form is processed on website B. Here is the page on website A with the iframe. I have hard coded the height at 100px:
[Code]....
Once the Save button is clicked, website B processes the data in this form, and sends messages and a dropdown box back to the iframe. When it does this, the iframe needs to have the height adjusted. How do I increase the height when this happens?
This is the vb.net page the goes to the iframe:
[Code]....
View 2 Replies
Sep 1, 2010
I have a small issue with ModalPopupExtender. It opens in an Iframe initially, and shows the page: dd_contact.aspx After I have entered the contact details, the IFrame redirects to the contact_details.aspx page to show what I have loaded.The problem is when I close that modalpopup-window and click again to show the modalpopup, the iFrame shows the contact_details.aspx page, and not the add_contact.aspx page
View 3 Replies
Oct 19, 2010
I am trying to use the TabContainer/TabPanel controls to create 3 tabs. The tabs themselves will always appear, however, only the first tab will ever display. When I look at the source of the page, I find that the 2nd and 3rd panels have style="visibility:hidden;display:none" on them. The only time this is not true, is if the content inside the tables is text that is on the source, nothing generated.
I have tried it using controls, repeaters, adding all my tabs dynamically, setting the properties of visibility=True and enabled=true. I am kind of pulling my hair out here.
ASPX coding:
<asp:TabContainer ID="aeDetails" runat="server">
<asp:TabPanel ID="placeholder" runat ="server" HeaderText ="PlaceHolder" ><ContentTemplate >Place Holder</ContentTemplate></asp:TabPanel>
</asp:TabContainer>
VB.NET Code:
' Get the content for the home page.
getHomePageContent()
' get the announcements, if any
getAnnouncements()
' get the events, if any
getEvents()
' remove placeholder after adding all three tabs
For i As Integer = 0 To aeDetails.Tabs.Count - 1
If aeDetails.Tabs(i).HeaderText = "PlaceHolder" Then
aeDetails.Tabs.RemoveAt(i)
Exit For
End If
Next
I will only put the code for one tab in here as they are all pretty much the same.
Private Sub getAnnouncements()
Dim nt As TabPanel = New TabPanel()
nt.HeaderText = "Viscardi Announcements"
nt.ID = "tpAnnouncements"
nt.Visible = True
nt.Enabled = True
Dim nl As Label = New Label()
Dim sb As StringBuilder = New StringBuilder()
Dim anRec As HVS_Announcements_Record = New HVS_Announcements_Record
Dim anList As List(Of HVS_Announcements_Record) = getCurrentAnnouncments()
Select Case anList.Count < 1
Case True
nl.Text = "There are currently no announcments for the Henry Viscardi School"
nt.Controls.Add(nl)
aeDetails.Tabs.Add(nt)
Return
End Select
sb.Append("<ul>")
For Each anRec In anList
sb.Append("<li><a onclick='MM_openBrWindow")
sb.Append("('announcementDetails.aspx?id=" & anRec.HVS_AR_Id & "','newWindow','status=yes,scrollbars=yes,resizable=yes,width=600,height=500'")
sb.Append("target='_blank' title='Click to view full contents of the announcements'>")
sb.Append(anRec.HVS_AR_AnnouncementTitle & "</a></li>")
Next
sb.Append("</ul>")
nl.Text = sb.ToString()
nt.Controls.Add(nl)
aeDetails.Tabs.Add(nt)
End Sub
All of the content that is generated by the various routines is in the page source, just hidden.
View 3 Replies
Jan 7, 2010
I have Gridview like this:
<asp:GridView ID="gvPartsSearchResult" runat ="server" CssClass="MRJ_TextGrid">
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:RadioButton
ID="rdButton"
runat="server"
AutoPostBack ="true"
onclick="javascript:CheckOtherIsCheckedByGVIDMore()"/>
<asp:HiddenField
ID="hdnFileExtension"
runat="server"
Value ='<%#Bind("FILE_EXTENSION")%>'/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I want to read the hidden field value when the user clicks on the radio button.
View 2 Replies
Oct 19, 2010
I am developing an application in which I have a page and at the bottom of the page there is an Iframe and inside of it is a Facebook login button and a asp.net login control.
When I scroll to the bottom of the page where the iframe is and then I put my mouse cursor in the username textbox of the loging control and having loged in before; when I type the first letter of my username under the text box apperas a kind of 'autosuggest' box with my user name in it...
That 'autosuggest' type of box (which is standard of a textbox) which should show right under the text box actually shows up 6 inches below it because I scrolled the page. In fact once it is displayed, that 'autosuggest' box stays fix in its position and I can scroll the page up and down with my mouse roller and the text box goes up and down with the page but the 'autosuggest' box stays in its place without moving...
Also the facebook login button when clicked generates a login dialog box inside a browser popup. But when I have it inside he iframe and the page is scrolled to the bottom when the iframe and the facebook login button are then the popup actually apears off screen, way, way down and low on my computer screen so much so that I cant even see it. I know it is there because of the taskbar..
View 1 Replies
Jun 28, 2010
I have a page, under a master page. I gave a button for printing the page. But the page will be printed along with the master page contents too. How is it possible to print only the contents of the current page excluding the master page contents ?
View 2 Replies
Mar 11, 2010
how can I print the content of an asp.net panel?I have some panels in my webform, but I need to print the content of one of them. So how can I do this.
View 8 Replies
Jan 29, 2011
How to set a iframe with with and height automatically dependen on content
View 2 Replies
Feb 2, 2011
We have files on server of several types (.pdf, .docx, .jpeg). The scenario is a user press a button (a link) and the print dialog opens which will print the content of a file chosen.
I think it's gonna be a link to another page where we fill in response with a file content and JavaScript window.print();
View 1 Replies
Mar 16, 2010
Ok. I've made this awe-crap-code Exporting table to XLS (but still no idea how to make it editable (not read only ))
The task for now is printing data from GridView. I can send it to HTML format (like on XLS) but with no lines and download file for print is weird.
How can I make some "Print-View" for my GridView (with lines... ) and Print it then ?
Is it possible on web site ? without download.
by the way here is how I do export ..)
using System;
using System.Data;
using System.Configuration;
using System.IO;
using System.Web;
[Code]....
View 1 Replies