Question

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

Was it helpful?

Solution

Call DataBind Method on calendar extender instance.

clndrStartDate.DataBind();

This solution worked for me.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top