I have the following UpdateProgress:
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="updCampos"
DynamicLayout="true">
<ProgressTemplate>
<div class="carregando">
<span id="sAguarde">Aguarde ...</span> <asp:Image ID="Image1" runat="server" ImageUrl="~/images/loading.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
I need to change in the code behind the text "Aguarde..." content that i nested inside the "sAguarde" span, but I don't know how to access this span. The language is C#.
Many thanks for the help.
Just change your <span>
control with Label as follows-
<asp:Label id="sAguarde" Text="Aguarde ..." runat="server" />
and access it from codebehind as follows-
Label progressMessageLabel = UpdateProgress1.FindControl("sAguarde") as Label;
if (progressMessageLabel != null)
{
progressMessageLabel.Text = "something";
}
You could change the span to a serverside control:
<span id="sAguarde" runat="server">Aguarde ...</span>
Then you can access it from the codebehind:
protected override void Render(HtmlTextWriter writer)
{
if (update) // globally declared update boolean to check if the page is being updated
{
HtmlGenericControl sAguarde = (HtmlGenericControl) UpdateProgress1.FindControl("sAguarde");
sAguarde.InnerHTML = "Hi";
}
base.Render(writer);
}
But note that the span's id will be rendered using ASP.NET control naming conventions.
For full context, see: Changing the contents of the UpdateProgress control
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With