|
Hi here is the code in my page
Dim attachment As String = "attachment; filename=Contacts.pdf"
Response.AddHeader("content-disposition", attachment)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/pdf"
when i try to open it, it opens Acrobat Reader but the Acrobat Reader gives me an error in the form of a message box with this message "Acrobat could not open 'PressRelease[1].pdf' because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded)."
|
|
|
|
|
sandhya14 wrote: Dim attachment As String = "attachment; filename=Contacts.pdf"
Response.AddHeader("content-disposition", attachment)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/pdf"
Hi,
instead of aboce code try it. ITs in C# so change according you requirement.
Response.ClearHeaders();<br />
Response.ClearContent();<br />
Response.ContentType="application/octet-stream";<br />
Response.AddHeader("content-disposition","attachment; filename=" + saveFilename);<br />
Response.WriteFile(savePath);<br />
Response.End();<br />
And tell if it helps you.
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
still it is giving the same error.....here is my full code.....
Response.ClearContent()
Response.ClearHeaders()
Response.Clear()
Response.Buffer = True
Dim attachment As String = "attachment;inline; filename=Contacts.pdf"
Response.AddHeader("content-disposition", attachment)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
' Response.ContentType = "Application/pdf"
Response.ContentType = "application/octet-stream"
Response.Charset = ""
Dim sw As New IO.StringWriter()
Dim htw As New HtmlTextWriter(sw)
GridSelected.RenderControl(htw)
Response.Write(sw)
lblmsg.Text = ""
Response.End()
Response.Close()
am trying to export the data as pdf......
|
|
|
|
|
sandhya14 wrote: am trying to export the data as pdf......
Is this possible with the above code?? I think she is trying the Export to Excel methodology.
sandhya14 wrote: Response.ClearContent()
Response.ClearHeaders()
Response.Clear()
Response.Buffer = True
Dim attachment As String = "attachment;inline; filename=Contacts.pdf"
Response.AddHeader("content-disposition", attachment)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
' Response.ContentType = "Application/pdf"
Response.ContentType = "application/octet-stream"
Response.Charset = ""
Dim sw As New IO.StringWriter()
Dim htw As New HtmlTextWriter(sw)
GridSelected.RenderControl(htw)
Response.Write(sw)
lblmsg.Text = ""
Response.End()
Response.Close()
Hey Sandhya, there many third party tools out in the market, try them to export to PDF. The above method will not help you.
|
|
|
|
|
Hey,
u read this link[^]
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
sandhya14 wrote: Dim attachment As String = "attachment; filename=Contacts.pdf"
Are you specifying a full filepath there? It doesn't look like that. It not going to automatically know where in the filesystem it is. Supply a full valid filepath to that pdf.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
am trying to export ,,,means to store the data somewhere inside the sysytem....
while click on the export button it will give the download window,whether to save or open the file...
if i say save,it will save the data with the file name(Contacts.pdf)in the selected path...den how
can i give the full path before storing the data?
|
|
|
|
|
MailMessage mm = new MailMessage();
mm.To = txt_Email.Value.Trim();
mm.Priority = MailPriority.High;
mm.From = "mycompname@mydomain.com";
mm.Subject = "Hi "+ txt_FirstName.Value.Trim() +" , Thank you for registering.";
mm.BodyFormat = MailFormat.Html;
mm.Body = sbMail.ToString();
But this is not working for yahoo.com,co.uk, and Rediffmail.com.rediff.com.
the mail is bouncing back and in yahoo goin in bulk /Spam Folder.
Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...
|
|
|
|
|
Which is your SMTP server ? Is it "localhost" ? Try authenticating your SMTP server before you send. Check this[^]
|
|
|
|
|
There is no code...
its not working....
Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...
|
|
|
|
|
ViReNdrA KuMaR KoHli wrote: mm.From = "mycompname@mydomain.com";
Please tell me you are actually replacing that line with a valid SMTP server.
If it's bouncing back it's because you don't have access to the SMTP server. If is's public mail that's probavly because it doesn't support it. As for the yahoo, if it's going in the spam folder... well than it is working.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Hello Genious..
I have some requirement like if i open pop up window then it must not blocked by pop blocker in any browser and it must be open regardless of Browser settings..
I am not much sure but some java scripts can be used for this stuff...
Any Idea...?
|
|
|
|
|
Pop up controllers works on the client side and ASP.NET on server side. So it can't be done. I don't think that JS can block pop up blockers since it will be a security violation.
|
|
|
|
|
rain raj wrote: Hello Genious..
Flattery will get you everywhere.
There is no blanket way to avoid popup blockers, many of them are configurable as to the users needs. However, in general you should only open a new window in response to a user event (such as clicking a button/link). You should avoid opening a new window automatically (such as in the page's onload).
|
|
|
|
|
Hi all,
In our application we are generating an excel file with 5000 + records which are fetched from DB, and its taking some time to generate and screen looks Idle (~ taking 15 to 20 minutes). and finally displaying "Connection timed Out error".
Now Client requires the process of generating excel to be done in background..So as soon as the "Generate Excel" button is clicked user should be redirected to the Home page and the download process for Excel should work in Background.
How to do this in Background???
Note:- In our Application we are using the StateServer to maintain Session
Can any body help to acheive this.
thanks in advance,
Eswar.
|
|
|
|
|
|
iam having a textbox at server side .which already contains cssclass which contains CssClass="textField_border"but now iwant to add one mores css DisplyText how this could be done
|
|
|
|
|
Try
CssClass = "STYLE1 STYLE2 STYLE3"
STYLE1 might be textField_border, STYLE2 will be you DisplyText. Make sure you give a WhiteSpace between two style.
The above solution is given in an assumption, since we can use this method in class = "STYLE1 STYLE2 STYLE3" where CssClass would be rendered as class only.
|
|
|
|
|
I don know, where i'm wrong....... But this piece of code is not working. Actually wat i am intending to do is, in a multi line textbox( id - txtMessage), whenever the no of characters entered is more than 10 an alert message has to be fired. As of now, i have called the function in my button event. Can any one give me the proper javascript coding which works in content pages.
;
function length()
{
if(document.all('txtMessage').value.length>10)
{
alert('Too many characters')
}
}
With Regards
Raamkumar.T.T
The most difficult phase of life is not when no one understands you ; It is when you don’t understand yourself.
|
|
|
|
|
In which event of the TextBox you are using this JavaScript?
Have you tried with onkeydown event?
|
|
|
|
|
Thanks for the response.. Am using onclientclick event.
The most difficult phase of life is not when no one understands you ; It is when you don’t understand yourself.
|
|
|
|
|
Then the problem is in the script only.
<script type="text/javascript">
function length()
{
if(document.all('txtMessage').value.length>10)
{
alert('Too many characters')
}
}
</script>
The above is your JavaScript. Here document.all('txtMessage') is not a valid method. You have to use document.getElementById('txtMessage')
|
|
|
|
|
I tried tat too. Anyway once again, i'll try tat n let u know. Thanks yaar.
The most difficult phase of life is not when no one understands you ; It is when you don’t understand yourself.
|
|
|
|
|
Did you checked whether the control going into the JavaScript function? Put alerts in appropriate locations and check where it is failing.
|
|
|
|
|
Venkatesh Mookkan wrote: document.getElementById('txtMessage')
I might be wrong, but this is not going to work if "txtMessage" is in content page. ASP.NET prefixes the content placeholder id along with the controls id. So a better approach would be
document.getElementById('<%=txtMessage.ClientId%>')
|
|
|
|