大佬教程收集整理的这篇文章主要介绍了asp.net – 绑定ListView InsertItemTemplate中的DropDownList抛出错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
问题是加载页面时出现以下错误:
数据绑定方法(如Eval(),XPath()和Bind())只能在数据绑定控件的上下文中使用.
我在网站的另一个页面上做了一个非常类似的设置,并没有给我们这个错误,所以我很困惑.我知道我可以通过不绑定,手动查找控件和获取值来解决这个问题,但这应该工作,我不明白为什么不是.
有什么想法吗?
源代码的更好部分如下.
<asp:LinqDatasource ID="ldsLOCATIOns" runat="server" ContextTypename="ClearviewInterface.ESLinqDataContext" Enabledelete="true" EnableInsert="true" OnInserTing="ldsLOCATIOns_InserTing" Ondeleting="ldsLOCATIOns_deleting" Tablename="crmLOCATIOns" OrderBy="addr1" OnSELEcTing="ldsLOCATIOns_SELEcTing" /> <asp:LinqDatasource ID="ldsFreeLOCATIOns" runat="server" ContextTypename="ClearviewInterface.ESLinqDataContext" OrderBy="addr1" Tablename="v_CVLOCATIOns" OnSELEcTing="ldsFreeLOCATIOns_SELEcTing" /> <asp:ListView ID="lvLOCATIOns" DatasourcEID="ldsLOCATIOns" DataKeyNames="ID" InsertItemPosition="LastItem" runat="server" > <InsertItemTemplate> <tr> <td colspan="6"><hr /></td> </tr> <tr> <td colspan="2"> <asp:DropDownList ID="ddlFreeLOCATIOns" DatasourcEID="ldsFreeLOCATIOns" DataTextField="addr1" DataValueField="record" MarkFirstMatch="true" SELEctedValue='<%# Bind("record") %>' runat="server" /> </td> <td><asp:ImageButton ID="btnAdd" CommandName="Insert" SkinID="Insert" runat="server" /></td> </tr> </InsertItemTemplate>
以上是大佬教程为你收集整理的asp.net – 绑定ListView InsertItemTemplate中的DropDownList抛出错误全部内容,希望文章能够帮你解决asp.net – 绑定ListView InsertItemTemplate中的DropDownList抛出错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。