DataBinding方法如Eval(),XPath()和Bind()只能在数据绑定控件的上下文中使用。 [英] DataBinding Method Such as Eval(),XPath(), and Bind() can Only be used in the Context of a databound Control.

查看:140
本文介绍了DataBinding方法如Eval(),XPath()和Bind()只能在数据绑定控件的上下文中使用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面中有一个webdatagrid,其中一个字段的aspx代码如下所示



 <   ig:TemplateDataField      =  TemplateField_0   宽度  =  20% < span class =code-keyword>>  
< ItemTemplate >
< asp:ImageButton ID = imgNewDocument runat = 服务器 AlternateText = 查看 宽度 = 16px 高度 = 9px SkinID = ViewIcon

< span class =code-attribute> < span class =code-attribute> CommandArgument =' <% #Eval( FileName)+ * + Eval( DocumentCaption)%> ;' OnClick = imgNewDocument_Click 工具提示 = 查看文档

< span class =code-attribute> / >
< / ItemTemplate >
< 标题 文字 = 查看 / >
< / ig:TemplateDataField >







我收到错误DataBinding方法如Eval(),XPath(),和Bind()只能在数据绑定控件的上下文中使用。



如何解决这个问题。

请帮忙我来解决这个问题。

解决方案

我尝试了以下代码,它正在运行。尝试使用此代码 -



< asp:linkbutton id =   lnkView runat =   server text =  查看 commandname =   ViewRow commandargument =  <%#Eval(  TourCode  )+ *   + Eval( TourCode  )%> ; xmlns:asp =  #unknown /> 


I have a webdatagrid in my page where aspx code of one field is as below

<ig:TemplateDataField Key="TemplateField_0" Width="20%">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgNewDocument" runat="server" AlternateText="View" Width="16px" Height="9px" SkinID="ViewIcon"

                                                    CommandArgument=' <%#Eval("FileName") + "*" +Eval("DocumentCaption")%>' OnClick="imgNewDocument_Click" ToolTip="View documents"

                                                    />
                                        </ItemTemplate>
                                        <Header Text="View" />
                                    </ig:TemplateDataField>




I got an error as "DataBinding Method Such as Eval(),XPath(), and Bind() can Only be used in the Context of a databound Control."

How can I solve this issue.
Please help me to solve this.

解决方案

I tried the below code and it is working. Try using this code -

<asp:linkbutton id="lnkView" runat="server" text="View" commandname="ViewRow" commandargument="<%#Eval("TourCode") + "*" + Eval("TourCode") %>" xmlns:asp="#unknown" />


这篇关于DataBinding方法如Eval(),XPath()和Bind()只能在数据绑定控件的上下文中使用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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