如何从后面的代码中更改评估(“列”)值

|| 嗨,我想从后面的代码中更改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(); 


}
    

要回复问题请先登录注册