كيفية التغيير برمجيا نص تمتد داخل قالب التقدم في C #؟

StackOverflow https://stackoverflow.com//questions/22016603

سؤال

لدي UpdateProgress التالي:

giveacodicetagpre.

أحتاج إلى التغيير في التعليمات البرمجية خلف النص "aguarde ..." التي قمت بتأليفها داخل فترة "Saguarde"، لكنني لا أعرف كيفية الوصول إلى هذه الفترة.اللغة C #.

شكرا جزيلا للمساعدة.

هل كانت مفيدة؟

المحلول

فقط قم بتغيير عنصر تحكم <span> مع التسمية كما يلي -

giveacodicetagpre.

والوصول إليها من CodeBehind كما يلي -

giveacodicetagpre.

نصائح أخرى

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top