我正在使用日间飞行员日历。
我遇到的问题是,无论何时发生更改,比如日历上的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()会被击中,但它实际上并没有刷新网格视图上的数据。我必须点击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>发布于 2017-01-24 05:51:46
如果EventResizeHandling属性设置为" CallBack“或"Notify”,它将使用ASP.NET CallBack机制来激发服务器端事件。ASP.NET CallBack以简化模式运行-事件处理程序只能更改组件本身(在本例中为DayPilotCalendar)。
如果您想要更改页面上的其他控件,则需要切换到"PostBack“并将这些控件放置在UpdatePanel中。
https://stackoverflow.com/questions/41811682
复制相似问题