设置日历扩展格式

发布于 2024-08-27 15:09:47 字数 539 浏览 4 评论 0原文

有谁知道是否有一种方法可以使用 aspx 中的动态值指定日历扩展器的格式? 我尝试了这个,但它似乎根本没有设置格式。有人看到它有什么问题吗:

    <asp:TextBox ID="tbStartDate" runat="server" />
    <act:CalendarExtender ID="clndrStartDate" PopupPosition="Right" runat="server"
 Format='<%# DefaultDateFormat %>' TargetControlID="tbStartDate"></act:CalendarExtender>

我在后面的代码的基页中有 DefaultDateFormat getter,如下所示:

public static string DefaultDateFormat
    {
        get { return "dd/MM/yyyy"; }
    }

任何帮助将不胜感激。 谢谢

Does anyone know if there is a way of specifying the Format of a calendar extender with a dynamic value from the aspx?
I tried this but it doesnt seem to set the format at all. Does anyone see anything wrong with it:

    <asp:TextBox ID="tbStartDate" runat="server" />
    <act:CalendarExtender ID="clndrStartDate" PopupPosition="Right" runat="server"
 Format='<%# DefaultDateFormat %>' TargetControlID="tbStartDate"></act:CalendarExtender>

and i have the DefaultDateFormat getter in a base page of the code beheind like this:

public static string DefaultDateFormat
    {
        get { return "dd/MM/yyyy"; }
    }

Any help would be appretiated.
Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心的憧憬 2024-09-03 15:09:47

在日历扩展器实例上调用 DataBind 方法。

clndrStartDate.DataBind();

这个解决方案对我有用。

Call DataBind Method on calendar extender instance.

clndrStartDate.DataBind();

This solution worked for me.

热血少△年 2024-09-03 15:09:47

你不是想说 Format="<% =DefaultDateFormat%>"并且您可能不希望 DefaultDateFormat 成为静态属性。
您的示例中似乎缺少“”和=。但我可能是错的。

Don't you mean to say Format="<% =DefaultDateFormat%>" and you may not want DefaultDateFormat to be a static property.
You appear to be missing "" and = in your example. But I could be wrong.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文