簡體   English   中英

DayPilot-Gridview不刷新

[英]DayPilot - Gridview not refreshing

我正在使用Daypilot日歷。

我的問題是,每當發生變化時,例如壓延機上的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>

如果EventResizeHandling屬性設置為“ CallBack”或“ Notify”,則它將使用ASP.NET CallBack機制來觸發服務器端事件。 ASP.NET CallBack以簡化模式運行-事件處理程序只能更改組件本身(在這種情況下為DayPilotCalendar)。

如果要更改頁面上的其他控件,則需要切換到“ PostBack”並將這些控件放置在UpdatePanel中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM