数据绑定方法如的eval(),XPath的()和bind()只能在数据绑定控件的上下文中使用 [英] Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control
本文介绍了数据绑定方法如的eval(),XPath的()和bind()只能在数据绑定控件的上下文中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误
数据绑定方法如的eval(),XPath的()和bind()只能在数据绑定控件的上下文中使用。
块引用>但所有我试图做的是ASP.NET Repeater控件
里面<若%(EVAL(信息)的ToString()== HttpContext.Current.Profile.UserName。)%GT;
<%{%GT; < ASP:ImageButton的=服务器等... />
<%}%GT;
解决方案语法
<%#的eval(...)%GT;
您可以做类似
< ASP:ImageButton的可见='<%#ShowImg(EVAL(的Container.DataItem,消息))%GT;' />
和在你的codebehind:
布尔ShowImg(string信息)
{
返回(MSG == HttpContext.Current.Profile.UserName);
}I am getting the following error
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
but all I am trying to do is inside a ASP.NET REPEATER Control
<% if ( Eval("Message").ToString() == HttpContext.Current.Profile.UserName) %> <% { %> <asp:ImageButton runat="server" etc.... /> <% } %>
解决方案The syntax is
<%# Eval("...") %>
You could do something like
<asp:ImageButton Visible='<%# ShowImg(Eval(Container.DataItem,"Message")) %>' />
and in your codebehind:
boolean ShowImg(string msg) { return (msg == HttpContext.Current.Profile.UserName); }
这篇关于数据绑定方法如的eval(),XPath的()和bind()只能在数据绑定控件的上下文中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文