服务器标签不规范 [英] The server tag is not well formed

查看:267
本文介绍了服务器标签不规范的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对GridView控件下面的图像按钮,我想调用的OnClientClick调用JavaScript方法与传递参数。我得到服务器标签格式不正确的错误。我试图改变双引号单引号等,仍然是同样的问题。

 的OnClientClick =返回ConfirmOnDelete('<%#的eval(姓名)%>');< ASP:ImageButton的ID =imgDelete的CommandName =删除的ImageUrl =〜/图片/ fbclose.png还有AlternateText =删除=服务器的OnClientClick =返回ConfirmOnDelete('<%#的eval( NAME)%GT;');/>


解决方案

您需要周围使用的OnClientClick 属性单引号:

 的OnClientClick =回归ConfirmOnDelete(小于%#的eval(姓名)%>);'

您也有评估功能后,一个孤立的单引号。如果你需要用您传递与报价函数的值,你可以这样做:

 的OnClientClick =回归confirmOnDelete(\\<%#的eval(姓名)%> \\);

I have the following image button on the GridView and I want to call the OnClientClick to call javascript method with passing a parameter. I am getting Server Tag is not well formed error. I tried changing double quotes to single quote etc, still the same issue.

OnClientClick="return ConfirmOnDelete('<%#Eval("Name")%>');"

<asp:ImageButton ID="imgDelete" CommandName="Delete" ImageUrl="~/images/fbclose.png" AlternateText="Delete"  runat="server" OnClientClick="return ConfirmOnDelete('<%#Eval("Name")%>');"/> 

解决方案

You need to use single quotes around the OnClientClick property:

OnClientClick='return ConfirmOnDelete(<%#Eval("Name")%>);'

You also had an orphaned single quote after the Eval function. If you need to wrap the value that you're passing into the function with quotes, you can do this:

OnClientClick='return confirmOnDelete(\"<%#Eval("Name")%>\");'

这篇关于服务器标签不规范的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆