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