gpt4 book ai didi

c# - 指定的转换对日期选择器无效

转载 作者:太空宇宙 更新时间:2023-11-03 20:22:44 25 4
gpt4 key购买 nike

我尝试在选择器中评估日期之前检查 null,因为我不允许输入任何日期:

 <telerik:RadDatePicker ID="rpick_to_date" runat="server" Visible="false" SelectedDate='<%# Eval("to_date") == null ? "" : Eval("to_date") %>'>
<Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">
</Calendar>
<DatePopupButton HoverImageUrl="" ImageUrl="" />
<DateInput DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy">
</DateInput>
</telerik:RadDatePicker>

但我一直收到以下错误:

Specified cast is not valid.

最佳答案

我相信您应该使用 DbSelectedDate 属性来绑定(bind)值而不是 SelectedDate

Use the DbSelectedDate property than SelectedDate to get or set the date content of RadDatePicker in a database friendly way. The only difference with SelectedDate is that it will not throw an exception if the new value is null or DBNull. Setting a null value will internally revert the SelectedDate to the null value, i.e. the input value will be empty.

From here

关于c# - 指定的转换对日期选择器无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12509852/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com