DayPilot - Gridview not refreshing

337 views Asked by At

I am using Daypilot Calendar.

The issue I have is that whenever there is a change, such as EventResize or EventMove on the calender the Gridview should update with the latest values

Example EventResize

 protected void DayPilotCalendar1_EventResize(object sender, EventResizeEventArgs e)
{
    int id = e.Recurrent ? Convert.ToInt32(e.RecurrentMasterId) : Convert.ToInt32(e.Id);
    new DataManager_MasterRota().MoveAssignment(id, e.NewStart, e.NewEnd, e.NewStart.DayOfWeek);
    DayPilotCalendar1.DataSource = new DataManager_MasterRota().GetAssignmentsForLocation(DayPilotCalendar1);
    DayPilotCalendar1.DataBind();
    DayPilotCalendar1.Update();


    GridView1.DataBind();
}

The Gridview1.DataBind() is being hit when an event is resized but its not actually refreshing the data on the gridview. I have to hit F5 to refresh the page for it to actually take affect on the Gridview.

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" Width="94px" DataSourceID="SqlDataSource1">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="PersonId" HeaderText="PersonId" SortExpression="PersonId" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" ReadOnly="True" />
            <asp:BoundField DataField="a" HeaderText="a" ReadOnly="True" SortExpression="a" />
        </Columns>
        <FooterStyle BackColor="#CCCC99" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <RowStyle BackColor="#F7F7DE" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#FBFBF2" />
        <SortedAscendingHeaderStyle BackColor="#848384" />
        <SortedDescendingCellStyle BackColor="#EAEAD3" />
        <SortedDescendingHeaderStyle BackColor="#575357" />
    </asp:GridView>
1

There are 1 answers

0
Dan On

If the EventResizeHandling property is set to "CallBack" or "Notify" it uses ASP.NET CallBack mechanism to fire the server-side event. The ASP.NET CallBack runs in a simplified mode - the event handler can only change the component itself (DayPilotCalendar in this case).

If you want to change other controls on the page you need to switch to "PostBack" and place the controls in an UpdatePanel.