私は 1 つの label とtextbox1
1textbox2
つの button を持っています。にテキストを入力しますtextbox1
次にボタンをクリックし、そのtextbox1
値をどのように表示しますtextbox2
か?
ボタンにクリックeventHandlerを追加し、textbox2のテキスト プロパティを設定します。
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
</form>
コードファイル内...
protected void Button1_Click(object sender, EventArgs e)
{
TextBox2.Text = TextBox1.Text;
}
this.textbox2.Text = this.textbox1.Text;
あなたのボタンをクリックしてこのコードを追加してください
textbox2.Text = textbox1.Text;
ボタンをダブルクリックします。これにより、コードビハインド テキストが表示されます。この書き込み後
textBox1.Text = textBox2.Text;
void Button1_Click(object sender, eventargs e)
{
TextBox1.Text = TextBox2.Text;
}