I have a wizard control inside an updatepanel. Some of the wizard steps take a few seconds to display, so I want to show an updateprogress control while they're loading. This is working, but I'd like to show a different image (random image selected from a folder) in the progresstemplate between each wizardstep.
I am able to access the image control and change the ImageUrl, but the progresstemplate never updates. It retains the first random image chosen from the very first time it loads.
I've tried updating the imageUrl on PageLoad and also by overriding the Render() method, but neither works.
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="500" >
<ProgressTemplate>
<div class="modalWrapper">
<div class="updateProgress">
<asp:Image ID="imgLoading" runat="server" AlternateText="Loading..." />
</div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
In codebehind:
protected void Page_Load(object sender, EventArgs e)
{
System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)UpdateProgress1.FindControl("imgLoading");
if (img != null)
img.ImageUrl = PickImageFromDirectory("~/images/loaders/"); //returns "~/images/loaders/randomimage.gif"
}
ALSO TRIED:
protected override void Render(HtmlTextWriter writer)
{
System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)UpdateProgress1.FindControl("imgLoading");
if (img != null)
img.ImageUrl = PickImageFromDirectory("~/images/loaders/"); //returns "~/images/loaders/randomimage.gif"
base.Render(writer);
}