Eval()不返回数据字段的值 [英] Eval() not returning values for Datafield
本文介绍了Eval()不返回数据字段的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我试图使用Eval返回值,但出现一条错误消息,指出该值未定义.我要附加相同的代码段.如果我使用整数值,但对于某些字符串值未定义,则该值正确返回.
< asp:LinkButton 文本 =" ID =" deleteImageButton" runat =" CommandName ="
span> =" deleteButton" OnClientClick =' <%#" + Eval(" ).ToString()+ " );" / >
函数ConfirmationMessage(eventType){
如果(eventType!= 空&& eventType!= ' 未定义')
返回确认(eventType);
}
请让我知道我哪里错了,请帮帮我.
预先感谢,
NutanR
解决方案
如何使用Eval构造OnClientClick存在问题.
尝试:OnClientClick = ' <%#Eval("event_name",返回ConfirmationMessage (\"{0} \");)%>'
try:
< asp:linkbutton 文本 =" id =" deleteImageButton" runat =" 命令名 =" CssClass =" =" 返回ConfirmationMessage('< %#Eval(" )%>')" </asp:linkbutton >
>
Hello,
I was trying to return values using Eval but got an error saying that the value is undefined. I''m attaching code snippet for same. The value returned correctly if I was using an integer value but said undefined for some string values.
<asp:LinkButton Text="" ID="deleteImageButton" runat="server" CommandName="Delete"
CssClass="deleteButton" OnClientClick='<%# "return ConfirmationMessage(" + Eval("event_name").ToString() + ");" %>' />
function ConfirmationMessage(eventType) {
if (eventType != null && eventType != 'undefined')
return confirm(eventType);
}
Please let me know where i am wrong and help me out please.
Thank in advance,
NutanR
解决方案
There is an issue on how you are forming your OnClientClick with Eval.
Try:OnClientClick='<%# Eval("event_name", "return ConfirmationMessage(\"{0}\");") %>'
try :
<asp:linkbutton text="" id="deleteImageButton" runat="server" commandname="Delete" CssClass="deleteButton" OnClientClick="return ConfirmationMessage('<%# Eval("event_name")%>' )"</asp:linkbutton>
这篇关于Eval()不返回数据字段的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文