单击按钮时如何更改标签文本 [英] How to change label text when I click the button
本文介绍了单击按钮时如何更改标签文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有
当我点击C#Web上的按钮时,如何更改标签文字?
有人能帮帮我吗?感谢您支持...
ID按钮名称为button3
ID标签名称为Label3
问候
Amad
我尝试过:
放
Dear all
How to change label text when I click the button at C# Web..?
Anybody can help me ? Thank you for supporting...
The ID button name is button3
The ID label name is Label3
Regards
Amad
What I have tried:
Put
AssociatedControlID="Button3" at HTML
<asp:Label ID="Label3" runat="server" Text="Amad" AssociatedControlID="Button3">
But It not worked
推荐答案
由于这是网络,你必须先决定是否要使用回发或不回发更改标签的文本。使用回发意味着您可以在C#中执行此操作,但在JavaScript中没有回发也很容易。
c# - 在按钮单击事件中
Since this is the web you have to first decide if you want to change the label's text with a postback or without a postback. With a postback means you can do it in C# but it's also easy to do without a postback in JavaScript.
c# - in the button click event
label1.Text = "SomeText";
javascript - 按钮的onclick功能
javascript - onclick function of the button
function SomeButtonClick(){
document.getElementById("label1").value = "SomeText";
}
这篇关于单击按钮时如何更改标签文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文