【问题标题】:Possible to call a function inside BoundColumn.DataField?可以在 BoundColumn.DataField 中调用函数吗?
【发布时间】:2010-10-11 18:56:39
【问题描述】:
<asp:BoundColumn DataField="pos" HeaderText="Principal Office" />

有没有可能……

<asp:BoundColumn DataField="postProccess(pos)" HeaderText="Principal Office" />

...所以我可以根据需要修改值?

废话:

A field or property with the name 'postProcess(pos)' was not found on the selected data source.

有人知道我可以如何覆盖那个东西吗??

【问题讨论】:

    标签: asp.net datagrid boundcolumn datafield


    【解决方案1】:

    这是您要用于模板列的完整 sn-p...

    <asp:TemplateColumn HeaderText="Principal Office">
       <ItemTemplate>
          <%# postProcess(Eval("pos")) %>
       <ItemTemplate>
    <asp:TemplateColumn>
    

    【讨论】:

      【解决方案2】:

      使用&lt;asp:templatecolumn&gt; 并在ItemDataBound 事件中进行后期处理

      【讨论】:

        猜你喜欢
        • 2020-04-30
        • 2019-10-17
        • 2016-03-26
        • 2012-02-06
        • 2014-09-02
        • 2020-12-23
        • 1970-01-01
        • 2017-01-22
        • 2021-12-08
        相关资源
        最近更新 更多