open pdf file C# and

I have some customers in a gridview. When I click on the customers I can get their names in a textbox. There is also a corresponding pdf document which should also be available if the user desires.

My problem is that I need to know who to open a pdf document using C# and I have to use a variable name as the name of pdf document, for example when the click on a button "open variable CustomerName.pdf".

I need to open a pdf file in a new window for viewing

thanks this works asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/customerUnit/Customer.pdf" Target="_blank">HyperLink

But I want to pass the pdf file as a variable "Customer.pdf" should be "VaribleCustmer.pdf"


I agree with @Ahmed from the comments, you shouldn't over-think this:

  • Simply link to the CustomerName.pdf if your using a hyperlink.
  • Simply redirect to the CustomerName.pdf if your using a button

But I want to pass the pdf file as a variable "Customer.pdf" should be "VaribleCustmer.pdf"

Asp Markup:

<asp:HyperLink ID="HyperLink1" 
               runat="server" Target="_blank">

Code behind:

var pdfFile = "Customer.pdf"; //or VaribleCustmer.pdf
HyperLink1.NavigateUrl= String.Format("~/customerUnit/{0}", pdfFile);

Need Your Help

How to write a sort operation that can handle back event in navigationconroller?

iphone xcode

How can I write a sort operation or another operation that doesn't stop to handle my touch events? For example, when I touch Back in UINavigationController, the app immediately goes back and releas...

Error with Rails test database using postgres using hstore

ruby-on-rails postgresql hstore

When using hstore in Postgresql 9.2 in a Rails 3.2 app, I got an error complaining as follows when raking my test database:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.