Как передать параметр Eval в Javascript onClientClick?

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.

Я хочу использовать javaquery на linkbutton, помещенном в Gridview, используя следующий код:

<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>
Теги:
asp-classic

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>

Справка

Ещё вопросы

Сообщество Overcoder
Наверх
Меню