c# - 当前上下文中不存在名称 'Bind'

标签 c# asp.net webforms

在日历控件中使用绑定(bind)方法时出现错误:当前上下文中不存在名称“绑定(bind)”。我怎样才能正确地做到这一点?我需要一种检查空值的方法。它在 Gridview 控件中

<asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%# string.IsNullOrEmpty(Bind("valid_date").ToString()) ? "0000-00-00 00:00:00.000": Bind("valid_date").ToString() %>' ></asp:Calendar>

最佳答案

SelectedDate = '<%# String.IsNullOrEmpty(Convert.ToString(Eval("valid_date"))) ? DateTime.MinValue : Eval("valid_date") %>'

关于c# - 当前上下文中不存在名称 'Bind',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22203620/

相关文章:

c# - 将图像导入为资源后,参数 docData 必须实现接口(interface) IVsTextStream ERROR

c# - Excel 电子表格的自定义 LINQ 提供程序?

asp.net - 检测浏览器刷新

javascript - 如何将通过 Javascript 添加的表行发布到 ASP.NET 中的服务器?

asp.net - 将数据从 Controller 传递到 View 并返回到 Controller

php - Web 表单未传递正确的值来搜索 MYSQL 记录

c# - 这段切换 bool 值的代码如何工作?

c# - 自动处理 Threading.Timer

asp.net - json字符串从vb.net端到asp.net

asp.net - 如何在 ASP.NET 中使用多个 .sitemap 文件