在数据列表中使用容器数据项时出现问题 [英] problem using container dataitem in datalist
本文介绍了在数据列表中使用容器数据项时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在linkbutton中添加命令参数,该参数显示来自代码隐藏的记录:
i am trying to add command argument in linkbutton, which display the record from codebehind:
<asp:LinkButton ID="lnkPrev" Visible="false" runat="server" Text="Prev" OnClick="lnkPage_Click"
CommandArgument="<%# Container.DataItem %>"><img src="../images/previousBtn.gif" border="0"/></asp:LinkButton></div>
我希望它显示出datalist或itemtemplate之外的commandargument.
如果我将它放在headertemplate中,则than(%#Conntainer.DataItem%#")不起作用.
那么替代方案
i want it to display commandargument out of datalist or itemtemplate..
if i put it headertemplate than("%#Conntainer.DataItem %#") is not work.
so what the alternative
推荐答案
Try
Try
<%# ((DataRowView)Container.DataItem)["FieldName"] %>
或
or
<%#DataBinder.Eval(Container.DataItem, "FieldName")%>
如果有帮助,请 投票 和 接受答案 .
Please vote and Accept Answer if it Helped.
尝试一下,
Try this,
CommandArgument=''<%# Eval("fieldname") %>''
这篇关于在数据列表中使用容器数据项时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文