简体   繁体   English

ASP.NET服务器标签格式不正确

[英]ASP.NET server tags are not well formed

I want to use some server tags in OnClientClick of LinkButton 我想在LinkBut​​ton的OnClientClick中使用一些服务器标签

<asp:LinkButton ID="lnkbtnID" OnClientClick='<%# "window.open('SomePage.aspx?Id=" + Eval("reqID") + "');" %>' runat="server" Text='<%# Eval("reqID")%>'>
</asp:LinkButton>

how to write this, it is giving the error that Server tags are not well formed. 怎么写,给服务器标签格式错误。

So how to write this correctly? 那么如何正确编写呢?

you can do this in code behind as well 您也可以在后面的代码中执行此操作

lnkbtnID.Attributes.Add("onclick","window.open('SomePage.aspx?Id="+reqID+"');");

lnkbtnID.Text=reqID;

How about that 那个怎么样

<a class="NewslinkButton" onclick="myRef = window.open(''+'<%# "SomePage.aspx?NewsID="+Eval("reqID") >','mywin','left=20,top=20,toolbar=0,resizable=1,scrollbars=1,height=300');myRef.focus()">
<asp:Literal ID="l1" runat="server" Text='<%# Eval("reqID")%>'></asp:Literal></a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM