Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-02-2009
Member
 
Join Date: Dec 2008
Posts: 33
asp.net gridview to pdf

I want to know that is pdf control can be used for asp.net,can i create pdf on the web.I would like to use the render output of a gridview saved as pdf and then open it for printing. Anything similar would be helpful for me so please suggest me how can i do that. thank you.
Reply With Quote
  #2  
Old 05-02-2009
Member
 
Join Date: Dec 2008
Posts: 322
Re: asp.net gridview to pdf

try this i think helpful for you

Quote:
.aspx

<asp:TemplateField>

<ItemTemplate>
<asp:LinkButton runat="server"

ID="LinkButton1"
Text="View File"

CommandName="open"
CommandArgument='<%# eval("filePath") %>'

ToolTip="select to view correspondence">
</asp:LinkButton>

</ItemTemplate>

</asp:TemplateField>

aspx.vb
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)

If e.CommandName = "open" Then

Response.ClearContent()

Response.ClearHeaders()

Response.ContentType = "application/pdf"
Response.WriteFile("\\" + e.CommandArgument.ToString())

Response.Flush()

Response.Close()

End If



If I add target="blank" to the link button, a new window opens but with nothing in it and the following is displayed within the URL

javascript:__doPostBack('ctl00$ContentPlaceHolder1$GridView1$ctl03$LinkButton1','')


Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "asp.net gridview to pdf"
Thread Thread Starter Forum Replies Last Post
Export Gridview to Excel in VB.Net Ariadne Software Development 4 15-06-2010 06:30 PM
Datagrid VS Gridview Techno Guru Software Development 5 16-01-2010 12:42 PM
How to use Gridview ImageField in DataImageUrlFormatString on ASP.net AK_Chopra Software Development 2 08-06-2009 09:54 PM
Nested DataTable for GridView Renderman21 Software Development 3 08-05-2009 02:08 PM
Getting data from a selected row in gridview in VB.Net Booth Software Development 2 15-01-2009 10:39 PM


All times are GMT +5.5. The time now is 02:41 PM.