Solved

ASP.NET DataGrid Button Column vs. HyperLink Column

Posted on 2006-06-21
4
306 Views
Last Modified: 2010-04-16
Hello, I am using an ASP.NET C# DataGrid to display a list of invoices for our customers when they log in. Everything works ok, but it needs some improvement.

First, I used just a Hyperlink Column and, when clicked, it automatically opened up the PDF in a new window.

Next, I changed it to using a command button, that writes out (Response.Write) JavaScript to open up the browser in a new window. I'm not found of the popups that it creates, especially since most people have pop-up blockers. However, this gave me the chance to do some back end programming before displaying the invoice. We need to keep track of who view which invoice and when.

When using a Hyperlink column, I couldn't figure out how to allow me to add a few commands in the code prior to displaying the invoice.

Any suggestions?
0
Comment
Question by:antisoc2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:Bowmanje
ID: 16951924
Can you point the link at an intermediary page that will run your code and then redirect to the correct page?  Or better yet, can you have the backend of the pdf page log the necessary information during init?  Then you simply have to pass the necessary information in the url or session variables.

HTH,
Josh
0
 

Author Comment

by:antisoc2
ID: 16951965
I thought about that, and probably will implement that solutions (intermediary page), but I was hoping that .NET gave some other solution.
0
 
LVL 3

Accepted Solution

by:
Bowmanje earned 250 total points
ID: 16952228
Another possibility would be using the ButtonColumn and doing your back-end work then doing a redirect...it doesn't have to be a popup.  You can use the ButtonType to make it a link if you prefer that style.  

There aren't really any command properties that are associated with the HyperlinkColumn.

HTH,
Josh
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now