我有几个按钮和一个文本框.我想这样做,当我按下按钮1时,文本框中的文本转到按钮,当我按下按钮2时,文本转到按钮2,依此类推.我现在有这个:
protected void Button1_Click(object sender, EventArgs e)
{
Button1.Text = TextBox1.Text;
}
protected void Button2_Click(object sender, EventArgs e)
{
Button2.Text = TextBox1.Text;
}
protected void Button3_Click(object sender, EventArgs e)
{
Button3.Text = TextBox1.Text;
}
Run Code Online (Sandbox Code Playgroud)
编辑:有没有更短的方法来做到这一点?