473,385 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

javascript popup window and multiple parameters

I've got a gridview with a template column calling a javascript
"win.open" routine (see below).

asp code:

<asp:TemplateField

HeaderText="Letter code"

ItemStyle-HorizontalAlign=Center>

<ItemTemplate>
<asp:hyperlink

ID=letter_code

runat=server

NavigateUrl=<
%#String.Format("javascript:void(OpenPopupWindow(' letter_response_detail.aspx?
letter_code={0}','width=900,height=450,top=475,lef t=300,scrollbars=yes,resizable=yes'));",Eval("lett er_code"))
%>>

<%#Container.DataItem("letter_code")%>
</asp:HyperLink>

</ItemTemplate>

</asp:TemplateField>

/asp code

Code for the routine is :

<script language="javascript">

function OpenPopupWindow(target_url,win_options)
{

Window.open(target_url,null,win_options)return false
}

</script>

This works fine. The problem that I have, is that I now need to call
the popup with two extra parameters which are taken from 2
dropdownlists elsewhere on the form.

Suggestions as to how I do this?

Cheers

Jul 24 '07 #1
1 5436
DaveyP wrote:
I've got a gridview with a template column calling a javascript
"win.open" routine (see below).

asp code:

<asp:TemplateField
HeaderText="Letter code"
ItemStyle-HorizontalAlign=Center>
<ItemTemplate>
<asp:hyperlink
ID=letter_code
runat=server
NavigateUrl=<
%#String.Format("javascript:void(OpenPopupWindow(' letter_response_detail.aspx?
letter_code={0}','width=900,height=450,top=475,lef t=300,scrollbars=yes,resizable=yes'));",Eval("lett er_code"))
%>>
<%#Container.DataItem("letter_code")%>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>

/asp code
Code for the routine is :

<script language="javascript">

function OpenPopupWindow(target_url,win_options)
{

Window.open(target_url,null,win_options)return false
There is no Window object in Javascript, it's named window. Javascript
is case sensetive.

Don't use null as window name. Use '_blank' if you want to open a new
window.

You have forgotten the semicolon between the statemenets.
}

</script>
This works fine. The problem that I have, is that I now need to call
the popup with two extra parameters which are taken from 2
dropdownlists elsewhere on the form.

Suggestions as to how I do this?
Do you want to take the values at the time of creating the page, or when
the user clicks the link?

For the first, you would add parameters in the String.Format, and append
the url in the format string with "&{1}&{2}".

For the second, you would add the values in the javascript. Perhaps
creating a new function if you don't want to change the OpenPopupWindow
function.

--
Göran Andersson
_____
http://www.guffa.com
Jul 24 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
12
by: Mark Fox | last post by:
Hello, I am attempting to do something very simple. I have a page MainPage.aspx and a popup window Popup.aspx. When users click on the linkbutton in the popup window I am looking to do some...
5
by: Paul Krasucki | last post by:
This is for a search page that takes parameters on one page, processes the query, and displays them on another page. I've got a javascript popup window on a button click event. When the user...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
16
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
3
by: pavanip | last post by:
Hi, I have written the code for display popup window using javascript in button onclient click event. <asp:Button ID="Button1" runat="server" Style="position: static"...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.