Cómo cambiar mediante programación un lapso de texto dentro de un ProgressTemplate en C#?
-
21-12-2019 - |
Pregunta
Tengo el siguiente 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>
Tengo que cambiar en el código detrás del texto "Aguarde..." el contenido que me anidada dentro de la "sAguarde" útil, pero no sé cómo acceder a este período.El lenguaje es C#.
Muchas gracias por la ayuda.
Solución
Acaba de cambiar su <span>
control con la Etiqueta de la siguiente manera-
<asp:Label id="sAguarde" Text="Aguarde ..." runat="server" />
y acceder a ella desde el codebehind de la siguiente manera-
Label progressMessageLabel = UpdateProgress1.FindControl("sAguarde") as Label;
if (progressMessageLabel != null)
{
progressMessageLabel.Text = "something";
}
Otros consejos
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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow