J
jm
I have a parent window:
<script language="javascript">
function doSearch() {
result=showModalDialog("searchmni.aspx?lastname=smith");
alert(result);
}
</script>
<input id="btnOpenSearch" onclick="doSearch();" type="button"
value="search" runat="server" text="Button" />
<input type=textbox id="txtResponse" >
In my child window, the popup populates and then has a bound
hyperlinkcolumn. For testing sakes, I just put this for the
hyperlinkcolumns argument:
<asp:HyperLinkColumn DataNavigateUrlField="mniMiddleName"
DataNavigateUrlFormatString="Javascript:testlink();"
DataTextField="mniMiddleName" HeaderText="Middle Name"
DataTextFormatString="{0}"></asp:HyperLinkColumn>
the javascript is simple:
function testlink(){
window.returnValue="test";
window.close();
}
What I found was that if I click the hyperlinkcolumn in the modal
dialog, the javascript opens another window. It does not simply
execute the javascript. If I run the modal dialog as a normal page, I
can get code to execute (of course it does nothing as it is not a
dialog at that point) - no errors. It is simply because it is inside
the modal. Any ideas how to make this code execute?
I have tried:
DataNavigateUrlFormatString="Javascript: var x=testlink();"
DataNavigateUrlFormatString="Javascript: var x=if(testlink()"
all of them open another window with the call to the javascript in the
address bar.
What am I doing wrong? Thank you.
<script language="javascript">
function doSearch() {
result=showModalDialog("searchmni.aspx?lastname=smith");
alert(result);
}
</script>
<input id="btnOpenSearch" onclick="doSearch();" type="button"
value="search" runat="server" text="Button" />
<input type=textbox id="txtResponse" >
In my child window, the popup populates and then has a bound
hyperlinkcolumn. For testing sakes, I just put this for the
hyperlinkcolumns argument:
<asp:HyperLinkColumn DataNavigateUrlField="mniMiddleName"
DataNavigateUrlFormatString="Javascript:testlink();"
DataTextField="mniMiddleName" HeaderText="Middle Name"
DataTextFormatString="{0}"></asp:HyperLinkColumn>
the javascript is simple:
function testlink(){
window.returnValue="test";
window.close();
}
What I found was that if I click the hyperlinkcolumn in the modal
dialog, the javascript opens another window. It does not simply
execute the javascript. If I run the modal dialog as a normal page, I
can get code to execute (of course it does nothing as it is not a
dialog at that point) - no errors. It is simply because it is inside
the modal. Any ideas how to make this code execute?
I have tried:
DataNavigateUrlFormatString="Javascript: var x=testlink();"
DataNavigateUrlFormatString="Javascript: var x=if(testlink()"
all of them open another window with the call to the javascript in the
address bar.
What am I doing wrong? Thank you.