帮我这个任务,带有标签控件的文本框 [英] help me this task, textbox with label control
本文介绍了帮我这个任务,带有标签控件的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们,
你可以帮我吗?我正在使用ASP.NET,C#,SqlServer
我在网页上有一个文本框标签和一个提交按钮。
如果我在文本框中输入任何文本...,在标签中它必须显示YES
如果我将文本框留空,则标签必须显示空白
你可以帮我吗。
提前谢谢...
Hi friends,
can you please help me. am using ASP.NET, C#, SqlServer
I have a textbox label and a submit button on webpage.
If i enter anything text in textbox..., In label it must display YES
if i left textbox empty the label must display blank
can you please help me.
Thanks in advance...
推荐答案
你好ranjith
这是我的解释
hello ranjith
here is my explanation
<asp:textbox onkeyup="return getbinded();" xmlns:asp="#unknown" ></textbox>
javascript函数
javascript function
<script type="text/javascript">
function getbinded()
{
if(document.getelementbyid('txtboxid').text.length>0)
{
document.getelementbyid('labelid').innertext='yes'
}
else
{
document.getelementbyid('labelid').innertext='';
}
}
window.onload=getbinded()
</script>
希望这可以帮到你:)
hope this will help you :)
试试这个
try this
if (textbox1.text.length == 0)
{
label1.text="No";
}
else
{
label1.text="Yes";
}
这是你想要的...... ??
Is this is what you wanted..??
试试这个。
Try this.
<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="textboxchanged" AutoPostBack="true"></asp:TextBox>
<asp:Label ID="lbl" runat="server" Text="No"></asp:Label>
protected void textboxchanged(Object sender, EventArgs e)
{
if (TextBox1.Text != "")
{
lbl.Text = "Yes";
}
else { lbl.Text = "No"; }
}
这篇关于帮我这个任务,带有标签控件的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文