<asp:TemplateColumn HeaderText="判断显示">
<ItemStyle Width="6%"></ItemStyle>
<ItemTemplate>
<asp:Label text='<%#DataBinder.Eval(Container, "DataItem.sign").ToString()=="1"?"确定":"取消"%>' Runat=server ID="label55">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

解决方案 »

  1.   

    一段代码,在DataGrid的ItemDataBound事件中if(e.Item.ItemIndex>=0)
    {

    if(e.Item.Cells[6].Text!="1900-1-1 0:00:00") 
    {        
                       //如果时间不等于1900-1-1,那么直接显示时间
    e.Item.Cells[6].Text=Convert.ToDateTime(e.Item.Cells[6].Text).ToString("yyyy-MM-dd");
    }
    else      //如果时间等于1900-1-1,那么显示’未归还‘
    {
    e.Item.Cells[6].Text="未归还";
    }
    }
      

  2.   

    to:adminlxj79(lixj)
    请问怎样在模板列的定义中调用一个指定的函数?
    (我用的是后代码编程的方式),我学B/S和asp.net不久,好多问题都不清楚。我现在一个人在开发一套供50多个单位同时使用的OA,其间遇到的问题有N多个,真是郁闷极了。
    而且我的分数也快要用完了。如果csdn要评一个在一段时期内提问最多的人,说不定就会有我呢。   m(^o^)m