Below is my HTML File code
<div>
<asp:Panel ID="pnlPDF" runat="Server">
<iframe type="application/pdf" src="up/waters 6form.pdf"
width="956" height="500"></iframe>
</asp:Panel>
</div>
In this HTML there is a Fill-able PDF...
User enters data and submits.
when user submits I need to convert into PDF File.
assume that pdf file contains
Name: __________
Gender: __________
when user enters the detail...how to save as pdf
It sounds like there's two issues:
1. Transfering the data from the fillable PDF to the ASPX page. This is as trivial as changing the post to the aspx page.
2. Creating a PDF. This will take a little more work, and probably requires a third-party product like PDFSharp.
Alternatively, have you looked at FDF? http://www.adobe.com/devnet/acrobat/fdftoolkit.html
Related
nesting of image inside a LinkButton shows image on one page & doesn't show image on another page below are two sample code from two different pages in the same root director.It works fine on one page but on the other page is doesn't show any download image rather shows the text download in place of image.
I have done troubleshooting for sometime and replace the code also but it doesnt show download image for any reason on the second page..
<asp:LinkButton ID="lnkbtnDownload" runat="server" onclick="lnkbtnDownload_Click" meta:resourcekey="lnkbtnDownloadResource1">
<asp:Image ID="imgDownload" runat="server" ImageUrl="~/images/download.png" meta:resourcekey="imgDownloadResource1" />
</asp:LinkButton>
<asp:LinkButton ID="lnkbtnDownload" runat="server" onclick="lnkbtnDownload_Click" meta:resourcekey="lnkbtnDownloadResource1">
<asp:Image ID="imgDownload" runat="server" ImageUrl="~/images/download.png" meta:resourcekey="imgDownloadResource1" />
</asp:LinkButton>
HTML OUTPUT
HTML for above two code sample render as below
<img alt="Download" src="images/download.png" id="MainContent_imgDownload">
Download
Both Pages are in the same root directory...
The problem probably comes from a discrepancy in your resource files or missing a resource file completely for the second page. Obviously you have one for the first, but possibly not for the other which has different naming.
If you are using meta:resourcekey, there are some things you have to considerate.
Make sure that your local resource files meet the following criteria:
They are in an App_LocalResources folder.
The base name matches the page name.
For example, if you are working with the page named Default.aspx, the
resource files are named Default.aspx.resx (for the default
resources), Default.aspx.es.resx, Default.aspx.es-mx.resx, and so on.
The resources in the file use the naming convention
resourcekey."property". For example, key name Button1."Text".
Source: MSDN
In my ASP.NET web form, I'm trying to customize my File Upload panel. What I do is simply put an HTML input button and a textbox. And there's a hidden HTML file upload control. When user clicks on the button, file select window appears, when user selects the file, the value is written to the visible textbox.
It's all good so far. But I'm having a problem while trying to attach the selected file to email in code page.
Here's the HTML markup:
<asp:ImageButton ID="clickme" runat="server" ImageUrl="Images/browse.png" OnClientClick="$('#uploadme').click(); return false;" />
<input id="uploadme" name="uploadme" type="file" style="visibility: hidden;" onchange="CopyMe(this, 'txtFileName');" />
<input id="txtFileName" type="text" name="txtFileName" readonly="readonly" class="file-path" />
And the JS (I use this in order to copy the file name only and write it into txtFileName just to show to user):
<script type="text/javascript">
function CopyMe(oFileInput, sTargetID) {
var arrTemp = oFileInput.value.split('\\');
document.getElementById(sTargetID).value = arrTemp[arrTemp.length - 1];
}
And the CSS:
input[type=file] { width: 1px; }
I'm using the below code in my .cs file to get the file attributes:
HttpPostedFile file = Request.Files["uploadme"]
But I kept on getting null value. So after some research, I've learnt that my form has to use enctype="multipart/form-data" property. Since my .aspx file is under a master page file, I added this property to the form in my master page file. Now Request.Files["uploadme"] is not null but its file name is empty string and its ContentLength is 0.
I'm unable to understand what might be the source to this issue. If it's because of using Master Page's form, I can't add a form to my child page because it says a page can have only 1 form. I don't know if I could use JavaScript for uploading because I need to email the file after uploading so I don't know how to get the file after I upload via JS.
How can I solve this problem? It could be one way or another, all I need is a stylized upload panel and to e-mail file after uploading.
You're using a master page and I'm presuming that you are using .net 2.0 or greater. If that's the case, use a FileUpload control (you can still hide it using CSS). Using the FileUpload control means you won't need the enctype attribute (although you shouldn't generate any problems having it there).
This all being said, I don't believe to you copy values into file type fields and have documents upload. This would be a MAJOR security flaw as a website could potentially upload files from your machine without your knowledge.
I have an iframe, looks like this:
< iframe id="PDFLetter" src="http://127.0.0.1/letterwriterasp/pdfs/test.pdf" width="60%" height="500" runat="server" scrolling="auto" >< /iframe>
Problem is, that pdf file is regenerated. So I need to refresh the iframe to reflect the changes to the user. I tried this:
PDFLetter.Attributes("src") = ""
PDFLetter.Attributes("src") = "http://127.0.0.1/letterwriterasp/pdfs/test.pdf"
But to no avail. It doesn't refresh the pdf in the iframe.
Not sure what can be done here. Any ideas?
Thanks,
Jason
Are you doing this on a postback and entering the code in the PageLoad event? If so it should work (for complete control over html you can laways just write to a Literal control although this is much heavier).
Try adding a random number at the end of the pdf name using ?randomnumber so that it does not use a cached version of the pdf file.
Is there a good way to enable forms that come out of user content (CMS) that is displayed inside the form runat="server" tag? All sorts of services provide forms for users to paste into their website, which break if the content ends up inside a .net form. It seems to me that there must be a good way around this, but I can't seem to find any solutions.
The one solution I've found is to put them in an IFRAME. So instead of embedding your form inside the page:
<FORM action="http://www.example.com/target.html">
.. form content
</FORM>
create a new ASPX file like this:
<FORM action="http://www.example.com/target.html" target="_top">
.. form content
</FORM>
Then in your original page, you'll refer to it via an IFRAME:
<IFRAME src='myform.aspx'></IFRAME>
Some things you'll need to do:
Make sure that you do not include any <FORM runat="server"> inside the new ASPX file.
Adjust the size of the IFRAME and the ASPX file to be exactly the same
For the FORM in the new ASPX files, you probably want to set target='_top' to ensure when a user fills in the form, the result is in the main window rather than inside the IFRAME.
I have the following goal:
I Have a list of top menu links on my website
Home * Links * Quotes * Photos
The only difference is that whenever you are on a particular page, I want that page to just be text (not a href link) and the others to be links (to show that this is the page you are on):
i got this working but it seems very bad way of doing it and i am looking for a better way of doing this:
in my master page, i have the following:
<asp:ContentPlaceHolder runat="server" ID="TopMenuLinks">
</asp:ContentPlaceHolder>
In each individual separate page, i have the following (this is the Family Tree Example):
Family Tree would look like this:
<asp:Content ID="Content3" ContentPlaceHolderID="TopMenuLinks" runat="server">
Photos -
Travel -
Family Tree
<spanstyle="color:"#000088">Wiki</span> -
<span style="color:"#000088">Baby Blog</span>
</asp:Content>
Photos would look like this:
<asp:Content ID="Content3" ContentPlaceHolderID="TopMenuLinks" runat="server">
Photos -
Travel -
Family Tree -
<spanstyle="color:"#000088">Wiki</span> -
<span style="color:"#000088">Baby Blog</span>
</asp:Content>
So as you can see, in each page i essentially have duplicate code with that particular page not as a link.
Is there any cleaner way of doing this without duplicating a lot of this code on everyone of my pages?
the way i am
I did the same thing using a master page, using ASP:Hyperlink controls. In the code behind on the master page I had code to set the NavigateUrl to en empty string if the NavigateUrl matched the location of the child page.
It results in the effect you're looking for.
Create a UserControl for your common code and add a reference to each page. You could expose a Bool property on the control to either render hyperlinks or plain text and set that property as you need on each page.