我正在使用 Daypilot 日历。
我遇到的问题是,只要有更改,例如日历上的 EventResize 或 EventMove,Gridview 应该使用最新值更新
示例事件调整大小
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();
}
调整事件大小时会触发 Gridview1.DataBind(),但实际上并未刷新 gridview 上的数据。我必须按 F5 来刷新页面才能真正影响 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>