[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Change hyperlink to linkbutton to pass parameter

Posted on 2010-04-06
5
Medium Priority
?
970 Views
Last Modified: 2013-12-20
I need help writing a LinkButton from a DetailsView to render another page in a popup window.  The following ASP.NET 2.0 shows the query string I'm trying to pass.  It works just fine, but Ionly with a literal (...FacilityID=240).  

<a href="javascript:;" onclick="javascript:window.open('FacilityImages.aspx?Table=CertificationCriteria2_FacilityImages&FacilityImages_FacilityID=240','','left=600px, top=100px, width=540px, height=600px, scrollbars=yes, status=no, resizable=yes');return false;">Test</a>

I tried using {0}:

<a href="javascript:;" onclick="javascript:window.open('FacilityImages.aspx?Table=CertificationCriteria2_FacilityImages&FacilityImages_FacilityID={0}','','left=600px, top=100px, width=540px, height=600px, scrollbars=yes, status=no, resizable=yes');return false;">Test</a>

And <%# Eval(“FacilityID”)%>

<a href="javascript:;" onclick="javascript:window.open('FacilityImages.aspx?Table=CertificationCriteria2_FacilityImages&FacilityImages_FacilityID=<%# Eval(“FacilityID”)%>,'','left=600px, top=100px, width=540px, height=600px, scrollbars=yes, status=no, resizable=yes');return false;">Test</a>

To no avail.  Please help.
0
Comment
Question by:mikrojones
  • 3
  • 2
5 Comments
 

Author Comment

by:mikrojones
ID: 29935219
I need to do the same thing for a HyperLink control, i.e., create a LinkButton control that passes two parameters to another Web page in a popup.  The following works but the user may lose context:

<asp:HyperLinkField DataNavigateUrlFields="FacilityID,MeterID," DataNavigateUrlFormatString="~/MeterImages.aspx?Table=MeterSpecification_MeterImages&amp;MeterImages_FacilityID={0}&amp;MeterImages_MeterID={1}" Text="Submit photograph(s)"></asp:HyperLinkField>
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 30224750
--?The following works but the user may lose context:
You mean popup?
Did you try setting the property Target="_blank" ?
0
 

Author Comment

by:mikrojones
ID: 30306688
I think my question was a little confusing.  I need a popup so the user will be aware s/he has two windows open.  Previously, I used a hyperlink to open another page in the same window, and the user may forget s/he needs to go back to the previous page.  Thanks.
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 750 total points
ID: 30310405
--->I need a popup so the user will be aware s/he has two windows open.
HyperLink and HyperLinkField both has a property named - "Target".
Set it to "_blank" and when user click on hyperlink ...it will open in different window i.e. popup...

another way if you want to use LinkButton will be injecting javascript from code-behind upon button click like shown here:
http://dotnetslackers.com/articles/aspnet/JavaScript_with_ASP_NET_2_0_Pages_Part1.aspx#s6
0
 

Author Closing Comment

by:mikrojones
ID: 32653050
Link to article on injecting javascript into ASP .NET 2.0 Web pages was instructive.  It helped me solve the question.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

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

This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

640 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