I am using Devexpress Calendar control to disable some dates and change there Text Value, i.e I am changing the dates that are less than 10 by concatenating a leading 0 with them. e.g from 1, 2, 3 to 01, 02, 03 and so on. for this purpose i am triggering it's Cell Initialize and Cell Prepared Event. it does work fine but when i navigate to another month it keeps on loading why is it doing so? kindly suggest alternatives if it's not going to be solved this way.

My Code So far:
C# Codebehind:

protected void ASPxDateEdit1_CalendarDayCellPrepared(object sender, CalendarDayCellPreparedEventArgs e)
    {
        int Date;
        bool isValidDate = int.TryParse(e.Date.Day.ToString(), out Date);
        if (isValidDate)
        {
            if (Date > 0 && Date < 10)
            {
                e.Cell.Text = "0" + e.Date.Day.ToString();
            }
        }

    }

ASPX:

<dx:ASPxPopupControl ClientInstanceName="ASPxPopupClientControl" Width="300px" Height="150px"
    MaxWidth="800px" MaxHeight="300px" MinHeight="150px" MinWidth="150px" ID="pcMain"
    ShowFooter="True" FooterText="HolidayIn" PopupElementID="d1" HeaderText="Select Date From"
    runat="server" EnableViewState="false" PopupHorizontalAlign="LeftSides" PopupVerticalAlign="Below" EnableHierarchyRecreation="True">
    <ContentCollection>
        <dx:PopupControlContentControl runat="server">
            <asp:Panel ID="Panel1" runat="server">
                <table>
                    <tr>
                        <td style="color: #666666;">
                            <div style="float: left">
                                <dx:ASPxCalendar ID="ASPxCalendar" EnableTheming="true" HeaderStyle-CssClass="MainHeader" CssClass="Align"
                                    HeaderStyle-Paddings-PaddingLeft="70px" HeaderStyle-Cursor="pointer" ShowDayHeaders="true" ShowClearButton="false" ShowTodayButton="false"
                                    TodayButtonText="Today's Date" RootStyle-Wrap="True" DayStyle-CssClass="DayStyle" ShowWeekNumbers="false" Height="200px" Width="300px"
                                    HighlightWeekends="true" HighlightToday="true" DayHeaderStyle-CssClass="Header" Theme="Office2003Blue" runat="server"
                                    DayDisabledStyle-BackColor="White" DayDisabledStyle-Font-Strikeout="true" OnDayCellPrepared="ASPxDateEdit1_CalendarDayCellPrepared">
                                </dx:ASPxCalendar>
                            </div>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </dx:PopupControlContentControl>
    </ContentCollection>
    <ClientSideEvents CloseUp="function(s, e) { SetImageState(false); }" PopUp="function(s, e) { SetImageState(true); }" />
</dx:ASPxPopupControl>

Here is how it looks when it keeps loading and gets stuck there: Picture

NOTE: I am trying to align my date cell of calendar control as they don't remain proper on the page. I am attaching snapshots too.

Correct Formatted Calendar Control:
Correct
Incorrect Formatted Calendar Control:
Incorrect

Related posts

Recent Viewed