0
<td scope="col" style='display:<%#Eval("RETURNSTATUS")=='0'? "none" : "inline"%>'>
<asp:Button ID="Button1" runat="server" Text="İade Et" />
</td>
我寫了這段代碼,但沒有工作。你能幫忙嗎?如何使用eval值更改html元素顯示?
<td scope="col" style='display:<%#Eval("RETURNSTATUS")=='0'? "none" : "inline"%>'>
<asp:Button ID="Button1" runat="server" Text="İade Et" />
</td>
我寫了這段代碼,但沒有工作。你能幫忙嗎?如何使用eval值更改html元素顯示?
感謝您的回覆,但像this.I創建hiddenfield和設定值由#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事件
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";
}
}
你可以試試這段代碼嗎?
<td scope="col" style='<%#Eval("RETURNSTATUS")=="0"? "display:none" : "display:inline"%>'>
<asp:Button ID="Button1" runat="server" Text="İade Et" />
</td>
可以顯示RETURNSTATUS控件的aspx代碼嗎? –