且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在我的应用程序运行时更新标签文本

更新时间:2023-01-13 11:27:27

在ASPX页面中取一个隐藏字段。

从您的代码后面更新隐藏字段值。 (例如:发送到abc@xyz.com的电子邮件)



并在您的设计代码(.ASPX页面)中创建一个javascript方法。例如UpdateLabel()



现在设置计时器,以便可以在每个时间间隔调用此方法。 (例如每2秒。)



并且在此方法中将隐藏的字段文本分配给标签文本。



这将反映出来。



Happy Coding。 :)


在pre_Render事件中我们可以更改任何服务器控件的值​​lockquote>

I want to send mail to some clients.After clicking submit button a popup with a label is opened.Now after sending each mail I want to update the text of label in code behind.I know after postback,final result is shown.But in this case after each loop of sending mail I want to update text of label.How is this possible?
I am using c#

Take one hidden field in your ASPX page.
From Your code behind update the hidden field value. (For example: email sent to abc@xyz.com)

And in your design code (.ASPX page) create one javascript method. for example UpdateLabel()

Now set timer so that this method can be called at every interval of time. (for example every 2 seconds.)

and in this method assign hidden field text to the label text.

This will be reflected.

Happy Coding. :)


On pre_Render event we can change the value of any server control