[英]DayPilot - Gridview not refreshing
I am using Daypilot Calendar. 我正在使用Daypilot日历。
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 我的问题是,每当发生变化时,例如压延机上的EventResize或EventMove,Gridview应该使用最新值进行更新。
Example EventResize 示例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. 调整事件大小时会点击Gridview1.DataBind(),但实际上并未刷新Gridview上的数据。 I have to hit F5 to refresh the page for it to actually take affect on the 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>
If the EventResizeHandling property is set to "CallBack" or "Notify" it uses ASP.NET CallBack mechanism to fire the server-side event. 如果EventResizeHandling属性设置为“ CallBack”或“ Notify”,则它将使用ASP.NET CallBack机制来触发服务器端事件。 The ASP.NET CallBack runs in a simplified mode - the event handler can only change the component itself (DayPilotCalendar in this case). ASP.NET CallBack以简化模式运行-事件处理程序只能更改组件本身(在这种情况下为DayPilotCalendar)。
If you want to change other controls on the page you need to switch to "PostBack" and place the controls in an UpdatePanel. 如果要更改页面上的其他控件,则需要切换到“ PostBack”并将这些控件放置在UpdatePanel中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.