Telerik Reporting:如何处理在报告上生成红色错误框的空日期?
日期字段为报告上的文本框之一提供值;文本框属性页如下所示:
Value =Fields.eventdate.ToString("D")
当 eventdate 为 null 时,报告会显示红色错误框。在这种情况下处理空值的正确方法是什么?
我尝试使用三元运算符代替上述操作,但这会导致错误:
Value =(Fields.evendate != null) ? : Fields.eventdate.ToString("D") : String.Empty
Is it possible to trap this null in the ItemDataBinding eventhandler linked to the textbox?似乎无法从那里访问 Fields 集合:
private void textBox28_ItemDataBinding(object sender, EventArgs e)
{
Telerik.Reporting.Processing.TextBox tb = (Telerik.Reporting.Processing.TextBox) sender;
.
.
.
}
A date field supplies the value for one of the textboxes on the report; here's how the textbox property page looks:
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;
.
.
.
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
知道了:
Got it: