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 16th, 2006, 03:10 AM
Registered User
 
Join Date: Oct 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kawalsingh28 Send a message via Yahoo to kawalsingh28
Default opening a new window after clicking on an image

hi!

i want to open a new page when i click on an image displayed in datagrid.

    //Modify data in the dataset if the value is not null

  dr["FileViewer"] = "<img src='images/ViewGrey.bmp' border=0>";

how can i do it?
 
Old October 16th, 2006, 03:27 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi

Just add a javascript function on the onclick event on image, e.g. as below:

<img src="images/test.gif" onclick="javascript:ShowPage()">

Now create this method in javascript as below:

function ShowPage()
{
  window.navigate("yourpagename.aspx");
}

Regards
Mike
 
Old October 16th, 2006, 03:51 AM
Registered User
 
Join Date: Oct 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kawalsingh28 Send a message via Yahoo to kawalsingh28
Default

hi mike, i got the following error:

.......aspx.cs(969): The type or namespace name 'window' could not be found (are you missing a using directive or an assembly reference?)

public void ShowPage()
  {
    [u]window</u>.navigate("yourpagename.aspx");
  }
 
Old October 16th, 2006, 04:17 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

hey hey,

This is a client function to be written on client side as,

<script language="javascript">

function ShowPage()
{
  window.navigate("yourpagename.aspx");
}

</script>

Regards
Mike
 
Old October 16th, 2006, 04:48 AM
Registered User
 
Join Date: Oct 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kawalsingh28 Send a message via Yahoo to kawalsingh28
Default

hi!

u c, images will be populated in a datagrid from db at runtime. so i m not sure whether i can use this for my purpose. pages are basically ASP.NET and code is written in c#

thanx
kawal
 
Old November 1st, 2006, 05:52 AM
Skb Skb is offline
Authorized User
 
Join Date: Oct 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Pass the url to the function as a parameter like,

<img src="images/test.gif" onclick="javascript:ShowPage(strUrl)">

And


<script language="javascript">

function ShowPage(strPage)
{
  window.navigate(strPage);
}

</script>








Similar Threads
Thread Thread Starter Forum Replies Last Post
opening a new window rgpassey Javascript How-To 2 September 14th, 2005 11:38 AM
Opening Window from flash image arnabghosh Classic ASP Basics 1 June 10th, 2005 02:26 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
Opening New Window james_sellwood ASP.NET 1.0 and 1.1 Basics 5 June 12th, 2003 11:43 AM





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