web页面,两个textbox,当离开textbox1时textbox2根据条件自动获取textbox1部分值
private void textBox1_Leave(object sender, EventArgs e)
{
if (this.textBox1.Text.Length >= 8)
{
this.textBox2.Text = this.textBox1.Text.Substring(0, 4);
}
else
{
this.textBox2.Text = this.textBox1.Text;
}
}怎么不会执行?
private void textBox1_Leave(object sender, EventArgs e)
{
if (this.textBox1.Text.Length >= 8)
{
this.textBox2.Text = this.textBox1.Text.Substring(0, 4);
}
else
{
this.textBox2.Text = this.textBox1.Text;
}
}怎么不会执行?
function LevelTextBox(obj,src)
{
document.getElementById(obj).value=src.value;
}
</function>
function LevelTextBox(obj,src)
{
document.getElementById(obj).value=src.value;
}
</script>
TextBox 默认不回发数据。对于楼主的要求,一般来说,还是使用客户端的 javascript 来实现比较好,页面不会出现刷新
即 TextChanged 事件就相当于 javascript 的 onblur 事件。
function A(s)
{
document.getElementById("textbox2").value=s;
}
{
TextBox tb=(TextBox)o;
}
{ //用TextChanged事件多好啊
}