Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在C#中以编程方式更改ProgressTemplate中的跨度文本?_C#_Asp.net_Html_Updateprogress - Fatal编程技术网

如何在C#中以编程方式更改ProgressTemplate中的跨度文本?

如何在C#中以编程方式更改ProgressTemplate中的跨度文本?,c#,asp.net,html,updateprogress,C#,Asp.net,Html,Updateprogress,我有以下UpdateProgress: <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="updCampos" DynamicLayout="true"> <ProgressTemplate> <div class="carregando"> <span id="sAguarde">

我有以下UpdateProgress:

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="updCampos"
    DynamicLayout="true">
    <ProgressTemplate>
        <div class="carregando">
            <span id="sAguarde">Aguarde ...</span>&nbsp;&nbsp;<asp:Image ID="Image1" runat="server" ImageUrl="~/images/loading.gif" />
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>

阿瓜德。。。
我需要更改嵌套在“sAguarde”范围内的文本“Aguarde…”内容背后的代码,但我不知道如何访问此范围。语言是C#


非常感谢您的帮助。

您可以将span更改为服务器端控件:

<span id="sAguarde" runat="server">Aguarde ...</span>
但请注意,span的id将使用ASP.NET控件命名约定呈现

有关完整上下文,请参见:

只需使用标签更改
控件,如下所示-

<asp:Label id="sAguarde" Text="Aguarde ..." runat="server" />
Label progressMessageLabel = UpdateProgress1.FindControl("sAguarde") as Label;
if (progressMessageLabel != null)
{
    progressMessageLabel.Text = "something";
}

这将不起作用,因为跨度在更新进度内,您无法直接访问它。如何从母版页代码隐藏中访问它,其中UpdateProgress位于内容页中?
Label progressMessageLabel = UpdateProgress1.FindControl("sAguarde") as Label;
if (progressMessageLabel != null)
{
    progressMessageLabel.Text = "something";
}