[英]parameter passed via javascript - server tag not well formed
TemplateField of a gridview column. gridview列的TemplateField。
The OnClientClick keeps causing a "server tag not well formed error". OnClientClick不断导致“服务器标签格式错误”。 Any ideas?
有任何想法吗?
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='../../images/20X20%20Dialog%20Box.png'
OnClientClick='<%# string.Format("javascript: LoadPhysiologicalChart('{0}','{1}');", Eval("code"), txtMRN.ClientID)%>' AlternateText="Chart Data" />
Thanks... 谢谢...
It's the single-quotes. 这是单引号。 ASP.NET gets a little picky with the types of quotes you have on data-bound controls.
ASP.NET对数据绑定控件上的引号类型有些挑剔。
One thing: get rid of the javascript:
- that's not necessary in an onclick
event. 一件事:摆脱
javascript:
-在onclick
事件中不需要。
Try this, with escaped double-quotes instead: 尝试使用转义的双引号代替:
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl='../../images/20X20%20Dialog%20Box.png'
OnClientClick='<%# string.Format("LoadPhysiologicalChart(\"{0}\",\"{1}\");", Eval("code"), txtMRN.ClientID)%>'
AlternateText="Chart Data"
/>
Can you try the following ? 您可以尝试以下吗?
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='../../images/20X20%20Dialog%20Box.png'
OnClientClick="LoadPhysiologicalChart('<%#Eval("code";) %>','<%#Eval("txtMRN.ClientID";) %>');" AlternateText="Chart Data" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.