Pages Menu
Categories Menu

Posted by on Jul 6, 2010 in Blog, Programming | 3 comments

ASP.Net Popup window from a hyperlink within Gridview results that passes 2 parameters

I spent a fair amount of time nailing this one down so I figured I’d better record it for future reference.

From within your gridview section add your columns and change one of the columns to a template then you can manipulate what shows up for that column.

<asp:HyperLink ID=”HyperLink1″ runat=”server” Font-Underline=”True”
NavigateUrl=<%# String.Format(“javascript:void(‘http://intranet/somepage.aspx?parameter1=” & Eval(“gridviewColumnName1″) & “&parameter2=” & Eval(“gridviewColumnName2″) &  
“‘,’_blank’,’width=750,height=700,toolbar=no,status=yes,scrollbars=yes,resizable=no’))”, Eval(“gridviewColumnName1″)) %>
Text='<%# Bind(“gridviewColumnName1″) %>’></asp:HyperLink>

What you end up with is a hyperlink that looks something like this:


So the hyperlink will popup a window and take you to your specified page and passes 2 parameters to the page that can then be acted upon.

Hopefully this makes sense.  It does to me right now, but who knows when I come back to it later!  :)

Note:  many times when you copy and paste this sort of code into your environment you’ll have to change the apostrophes because they get replaced with a backwards apostrophe which will cause problems.


  1. After searching for quite a while on how to achieve this task, I almost gave up. Then, I ran across your solution and gave it a try. It works like a charm! Thank you very much for posting this for all to see.

  2. Thanks for a great piece of code. Unfortunately I found it works only in Firefox, not in Chrome or IE9.

  3. woooh man you have made it!!!!

Post a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>