Solved

ASP.NET DataGrid Button Column vs. HyperLink Column

Posted on 2006-06-21
4
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exception when using Alea null reference in fsharp.core.dll 3 79
C# LINQ 5 44
aspx ascx, c# 7 43
Easiest intro into .NET CORE? 2 32
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

739 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