Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.NET DataGrid Button Column vs. HyperLink Column

Posted on 2006-06-21
4
Medium Priority
?
335 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 1000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview

886 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