First of all, I have searched probably all threads on Stack OverFlow about my problem. Since I haven't find any expected result, so I forced my self to post this question.
<asp:HyperLink ID="lnkViewDoc" Text='View Document' NavigateUrl='<%# string.Format("javascript:window.open('ViewDoc.aspx?DocP={0}', 'MsgWindow','width=200,height=100')", Eval("vchDocPath")) %>' runat="server"></asp:HyperLink>
I tried another format. In following code, I am not getting error, but when clicking on link, nothing is happening like link is not clickable.
<asp:HyperLink ID="lnkViewDoc" Text='View Document' NavigateUrl='Javascript:void(window.open("<%# Eval("vchDocPath", "ViewDoc.aspx?DocP={0}") %>","mywindow","toolbar=0,width=500,height=500"))' runat="server"></asp:HyperLink>
PS: I have tried many other formats from stack overflow and other sites, but no luck.
Thanks in advance.
here's a sample html button that passes parameter to a javascript function..
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<button onclick='<%# "ShowWindow(\"" + "ViewDoc.aspx?DocP=" + Eval("vchDocPath") + "\")" %>'>View Document</button>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
<script type="text/javascript">
function ShowWindow(e) {
window.open(e, "mywindow", "toolbar=0,width=500,height=500");
}
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.