データをプルしてロードするのに時間がかかる非常に大きなページがあります。最初に .aspx ページに移動するとき、表示される前にウィンドウを閉じないように、読み込み中の .png 画像が表示されるようにしたいと思います。asp:UpdateProgress を入れてみましたが、これはページが読み込まれるまで表示されず、ページで何かを行います。ページの残りの部分が読み込まれる前に、最初に読み込み画面を取得するにはどうすればよいですか? 以下は、私が試したもので、うまくいきません。
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="10">
<ProgressTemplate>
<div id="updatestatus" class="shadow">
<asp:Label ID="Label12" runat="server" Text="Loading...">
</asp:Label>
<asp:Image ID="Image1"
runat="server" ImageUrl="~/images/1status.png" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<%-- My page loading stuff -->
</ContentTemplate>
</asp:UpdatePanel>
タイマーもつけてみました。ここで面白くなります。ContentTemplate 内のラベルは、目盛りで正常に表示されます。Content Template 内に配置した GridView はそうではありません。
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/1status.png" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" Visible="false">
<ContentTemplate>
<!-- My page loading stuff -->
</ContentTemplate>
</asp:UpdatePanel>
<asp:Timer ID="Timer1" runat="server" Interval="600" OnTick="Timer1_Tick"></asp:Timer>
protected void Timer1_Tick(object sender, EventArgs e)
{
UpdatePanel1.Visible = true;
Timer1.Enabled = false;
Image1.Visible = false;
}
updatepanel を完全に取り出して、タイマーで gridview の表示状態を変更するだけでも試しましたが、それでも機能しません。グリッドビューは表示されません。
興味深いのは、次のことを行うボタンをページに配置すると、
protected void ButtonHide_Click(object sender, EventArgs e)
{
if (GridView1.Visible)
{
GridView1.Visible = false;
}
else
{
GridView1.Visible = true;
}
}
それをクリックして、GridView を何回でも問題なく表示および非表示にすることができます。タイマーが違うのはなぜですか?