2017-01-23 70 views
0

我正在使用Daypilot日历。DayPilot - Gridview不刷新

我的问题是,每当有一个变化,如EventResize或EventMove在日历上在GridView应与最新值更新

例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(); 
} 

的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> 
+0

你的gridview是在一些面板? –

+0

我试过它内部和没有更新面板,结果是相同的,它无法刷新更新gridview数据 –

+0

我实际上已经将EventResize更改为回发,它的工作。可以使用Callback吗? –

回答

0

如果EventResizeHandling属性设置为“回调”或“通知”,它使用ASP.NET回调机制来触发服务器端事件。 ASP.NET CallBack以简化模式运行 - 事件处理程序只能更改组件本身(本例中为DayPilotCalendar)。

如果您想要更改页面上的其他控件,您需要切换到“PostBack”并将控件放置在UpdatePanel中。