ページで asp:UpdateProgress コントロールを使用していますが、複数のページで同じコントロールを使用したいのですが、コードをコピーして貼り付けたくはありません。パネルをユーザーコントロールに貼り付けて、ユーザーコントロールをページにドロップしても機能しません。しかし、私はユーザーコントロールに慣れていないので、うまくいけば簡単です。
UserControl .ascx ファイルの内容
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AjaxProgressLoader.ascx.cs" Inherits="MyNamespace.Controls.AjaxProgressLoader" %>
<asp:UpdateProgress runat="server" ID="PageUpdateProgress">
<ProgressTemplate>
<div id="Imgt" style="position: absolute; left: 0; top: 0; width: 100%; height: 100%;"
align="center" valign="middle" runat="server" class="blur">
<table width="100%">
<tr>
<td>
<img src="/Styles/Images/ajax_loader.gif" style="position: relative; horiz-align: center;
vert-align: middle; margin-top: 100px" width="75px" />
</td>
</tr>
<tr>
<td style="color: #FFFFFF">
Loading...
</td>
</tr>
</table>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
メインの .aspx ページ
<%@ Register TagPrefix="ajax" TagName="AjaxUpdateProgress" Src="~/Controls/AjaxProgressLoader.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManager ID="uxScriptManager" runat="server"></asp:ScriptManager>
<ajax:AjaxUpdateProgress ></ajax:AjaxUpdateProgress>
<asp:UpdatePanel runat="server" ID="Panel">
<ContentTemplate>
My Content...
</ContentTemplate>
</asp:UpdatePanel>