trystring y;
....<%# y =(string)(DataBinder.Eval(Container.DataItem, "x")) %>NOTE: if the expression is in ItemTemplate for controls like DataGrid, y will take the value of "x" from the last record

解决方案 »

  1.   

    试过了,不行,这行代码只能在IE中输出一个True of False
      

  2.   

    then use a function, assume you are using VB, function setVar (str as string) as string
      y = str
      setVar = y
    end function <%# setVar((string)(DataBinder.Eval(Container.DataItem, "x"))) %>
      

  3.   

    then use a function, assume you are using VB, function setVar (str as string) as string
      y = str
      setVar = y
    end function <%# setVar((string)(DataBinder.Eval(Container.DataItem, "x"))) %>thx,这样可以取得预期的Y值.
    但<%# setVar((string)(DataBinder.Eval(Container.DataItem, "x"))) %>
    已经输出了值.能做到取得Y值的同时,数据绑定的语句没有输出?
      

  4.   

    then do something like this in your codeforeach (object dataItem in YourList.DataSource) {
       y = ......;
    }