本文介绍了如何更改HTML元素的显示与EVAL价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<td scope="col" style='display:<%#Eval("RETURNSTATUS")=='0'? "none" : "inline"%>'>
<asp:Button ID="Button1" runat="server" Text="İade Et" />
</td>
我写这篇code,但不work.Can你帮忙吗?
I wrote this code but dont work.Can you help?
推荐答案
感谢您的回复,但它不喜欢干活解决的问题this.I创建由#eval hiddenfield和设定值
Thank your reply but it don't work.I solved problem like this.I create hiddenfield and set value by #eval
<td scope="col" >
<asp:Button ID="btnReturn" runat="server" CommandArgument='<%#Eval("InventoryId")%>' Text="İade Et" OnClientClick="return confirmReturnInventory()" />
<asp:HiddenField ID="hdnStatus" runat="server" Value='<%# Eval("Status") %>' />
</td>
落后于C#中,我写的方法中继器preRender事件
In c# behind,I wrote method preRender event of repeater
protected void rptInventoryList_PreRender(object sender, EventArgs e)
{
foreach (RepeaterItem ri in rptInventoryList.Items)
{
HiddenField hdnStatus = (HiddenField)ri.FindControl("hdnStatus");
Button btnReturn = (Button)ri.FindControl("btnReturn");
btnReturn.Visible = hdnStatus.Value == "0";
}
}
这篇关于如何更改HTML元素的显示与EVAL价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!