Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

javascript popup window and multiple parameters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DaveyP - 24 Jul 2007 11:18 GMT
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,left=300,scrollbars=yes,resizable=yes'));",Eval("letter_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
Göran Andersson - 24 Jul 2007 11:51 GMT
> I've got a gridview with a template column calling a javascript
> "win.open" routine (see below).
[quoted text clipped - 27 lines]
>
> 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.

> }
>
[quoted text clipped - 5 lines]
>
> 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.

Signature

Göran Andersson
_____
http://www.guffa.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.