紧急(在文本框中输入的值应在标签中显示b)
问题描述:
我在aspx页面中有一个文本框",标签"和按钮".如果我在文本框中输入了一些值,则tat值应在标签中显示b ...并且再次在同一文本框中输入一些值,tat值应在不干扰第一个值的情况下显示b,依此类推.非常紧急,请帮助我..............
Iam having a "TextBox" a "Label" and a "Button" in my aspx page. If i enter some values into the textbox,then tat values should b displayed in the label...and agaig i enter some values in the same text box,tat values should b displayed without disturbing the first value and so on....very urgent Help me please..............
答
尝试lbl.Caption += textbox.Text;
Abhinav建议的是一种服务器端方式,该方式需要回发才能生效.
我建议您继续使用Javascript.使用文本框onchange
或onblurr
事件.将它们附加到JS方法.在JS方法中,获取文本框的值并将其分配给所需的标签.
试试吧!
What Abhinav suggested is a server side way that would need a postback to take affect.
I would suggest you to go ahead with Javascript. Use textboxonchange
oronblurr
event. Attach them to a JS method. In the JS method, get the value of textbox and assign that to the desired label.
Try!