1

日付フィールドは、レポートのテキスト ボックスの 1 つに値を提供します。テキスト ボックスのプロパティ ページは次のようになります。

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

eventdateが null の場合、レポートにはエラー ボックスが赤色で表示されます。このシナリオで 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;
          .
          .
          .
    }
4

1 に答える 1

1

とった:

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

}
于 2011-09-15T19:25:04.443 に答える