问题描述
||
嗨,我想从后面的代码中更改eval(\“ columnName \”)值,例如,如果从下拉列表中选择价格,则数据列表中的eval应该更改为eval(\“ price \”),如果是乘积,则应将其更改为Eval(\“ product)。任何建议或替代方案将受到高度赞赏。
解决方法
你可以做这样的事情
<asp:Label ID=\"someLabel\" Text=\'<%# GetLabelText(Eval(\"price\"),Eval(\"product\")) %>\' .. />
和
public string GetLabelText(Object price,Object product)
{
if(/* check dropdownlist for price*/)
{
return price.ToString();
}
/* else */
return product.ToString();
}