Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2004, 02:27 PM
Authorized User
 
Join Date: May 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Opening a new window from a hyperlink in an ItemTe


I need to open a page in a new window when a hyperlink is clicked in a data grid?

Here's my code as of now:

<asp:TemplateColumn HeaderText="Copy&Create New Field" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="150px" FooterStyle-HorizontalAlign="Center" >

<ItemTemplate>

<asp:HyperLink runat="server" Text="Copy & Create" CausesValidation="False" NavigateUrl='<%# "fldCopyCreate.aspx?fldID=" & Container.DataItem("Field_ID") & "&tblID=" & Container.DataItem("Table_ID") & "&fldLogiName=" & Container.DataItem("Logical_Name") %>' />

</ItemTemplate>

</asp:TemplateColumn>

 
Old October 15th, 2004, 11:44 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

set the Target property of the Hyperlink to "_blank"

     Target="_blank"

Regards
Ganesh
 
Old October 18th, 2004, 08:42 AM
Authorized User
 
Join Date: May 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

THANK YOU. I was ONLY thinking in terms of JavaScript..

 
Old October 18th, 2004, 09:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Target="_blank" is actually the easiest, especially if you are using hyperlink controls. Otherwise, append javascript using the DataGrid's ItemCreated event, and add the javascript:

e.Item.Cells(<index>).FindControl("<id>").Attribut es.Add("<attribute>", "<script>")

Also make sure the hyperlink has an ID.

Brian
 
Old October 19th, 2004, 01:56 PM
Authorized User
 
Join Date: May 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Brian, right on, it worked like a charm!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a text file using hyperlink in a gridview absu General .NET 1 March 6th, 2009 02:03 AM
Opening a file using hyperlink absu ASP.NET 1.0 and 1.1 Basics 4 October 8th, 2008 09:24 AM
opening a new window rgpassey Javascript How-To 2 September 14th, 2005 11:38 AM
Opening New Window p_nut33 Classic ASP Basics 1 August 6th, 2004 08:11 PM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.