繁体   English   中英

Telerik报表:如何处理在报表上生成红色错误框的空日期?

[英]Telerik Reporting: how to handle null dates that generate red error box on the report?

日期字段为报告中的一个文本框提供值; 文本框属性页的外观如下:

         Value       =Fields.eventdate.ToString("D")

eventdate为null时,报告将以红色显示错误框。 在这种情况下,处理空值的正确方法是什么?

我尝试使用三元运算符代替上述方法,但这会导致错误:

         Value       =(Fields.evendate != null) ? : Fields.eventdate.ToString("D") : String.Empty

是否可以在与文本框关联的ItemDataBinding事件处理程序中捕获此null? 似乎无法从此处访问Fields集合:

   private void textBox28_ItemDataBinding(object sender, EventArgs e)
    {
          Telerik.Reporting.Processing.TextBox tb = (Telerik.Reporting.Processing.TextBox) sender;
          .
          .
          .
    }

得到它了:

private void textBox28_ItemDataBinding(object sender, EventArgs e)
{
  Telerik.Reporting.Processing.ReportItemBase item ;
  item = (Telerik.Reporting.Processing.ReportItemBase)sender;
  System.Data.DataRowView drv = (item.DataObject.RawData as System.Data.DataRowView);

  //now test the drv.Row[ colname ] for DBNull.Value

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM