A date field supplies the value for one of the textboxes on the report; here's how the textbox property page l开发者_高级运维ooks:
Value =Fields.eventdate.ToString("D")
When eventdate is null, the report displays an error box in red. What's the proper way to handle null values in this scenario?
I tried using the ternary operator in place of the above, but that causes an error:
Value =(Fields.evendate != null) ? : Fields.eventdate.ToString("D") : String.Empty
Is it possible to trap this null in the ItemDataBinding eventhandler associated with the textbox? It doesn't seem as though the Fields collection is accessible from there:
private void textBox28_ItemDataBinding(object sender, EventArgs e)
{
Telerik.Reporting.Processing.TextBox tb = (Telerik.Reporting.Processing.TextBox) sender;
.
.
.
}
Got it:
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
}
精彩评论