0

你好,我看到了一些关于如何做到这一点的例子,但不幸的是我最终遇到了一个错误

**Description:** An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The server tag is not well formed.

我想使用下面的代码在放置在 Gridview 中的链接按钮上使用 javaquery:

<asp:LinkButton ID="hlHierarchy" runat="server" OnClientClick= "return windowpop('~/../../..<%#Eval("NavigateURL") %>', 545, 433)">
<pre Class="td-heading" style="display: inline; font-weight:bold"><%# ((string)Eval("Name")).Replace("-", " ") %></pre>
</asp:LinkButton>

如果有,请帮我纠正任何语法错误,下面是 jquery:

<script language="javascript" type="text/javascript">

function windowpop(url, width, height) {
        var leftPosition, topPosition;
        //Allow for borders.
        leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
        //Allow for title and status bars.
        topPosition = (window.screen.height / 2) - ((height / 2) + 50);
        //Open the window.
        window.open(url, "Window2", "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
    }
</script>
4

1 回答 1

1

所以我弄清楚出了什么问题,更正的代码:

<asp:LinkButton ID="hlHierarchy" runat="server" OnClientClick= <%# "return windowpop('../.."+((string)Eval("NavigateURL")).Replace("~", "") +"', 1024, 768)" %>>
<pre Class="td-heading" style="display: inline; font-weight:bold"><%# ((string)Eval("Name")).Replace("-", " ") %></pre>
</asp:LinkButton>

参考

于 2013-11-11T14:39:33.913 回答