如何在单击事件时在文本框上显示数据? [英] how to display data on textbox when event is clicked?

查看:57
本文介绍了如何在单击事件时在文本框上显示数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了网络应用程序

其中三个文本框

当我在textbox1中输入值时...我希望该值应显示在textbox2和textbox3上





代码落后



i have create web app
in which taken three textboxes
when i entered value in textbox1..i want that value should display on textbox2 and textbox3


code is behind

public class Class1
{


          public double cal(double amount)
        {
            return((amount+(amount*0.01)));
        }










}

 protected void TextBox1_TextChanged(object sender, EventArgs e)
    {

        Class1 c = new Class1();
        TextBox2.Text = c.cal(Convert.ToDouble(TextBox1.Text)).ToString();
 TextBox3.Text = c.cal(Convert.ToDouble(TextBox1.Text)).ToString();
    }




 protected void Button1_Click(object sender, EventArgs e)
    {
        Class1 c = new Class1();
        TextBox2.Text = c.cal(Convert.ToDouble(TextBox1.Text)).ToString();
    }



在button_click上工作但不在textbox_textchanged上



所以telll关于这方面我


on button_click its working but not on textbox_textchanged

so telll me on this regard

推荐答案





你需要设置文本框的 AutoPostback = true [ ^ ]。



祝你好运
Hi,

You need to set your textbox''s AutoPostback = true[^].

best luck


这篇关于如何在单击事件时在文本框上显示数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆