---
title: "ASP.Net 将两个文本框中值的乘积在第二个文本框中的值输入完成后赋值给第三个文本框"
author: "piperzero"
date: "2013-01-22T12:22:00Z"
tags: []
slug: "asp-net"
draft: false
lastmod: "2013-02-21T19:49:22Z"
id: 1811354
url: "https://piperzero.iteye.com/blog/1811354"
---

首先需要创建三个文本框喽：txtBox1、txtBox2、txtBox3

完成以后给txtBox2添加文本框改变事件

protected void txtBox2\_TextChanged(object sender ,EventArgs e){

double price=Convert.ToDouble(txtBox1.Text);

int amount=Convert.ToInt32(txtBox2.Text);

double result=price.amount;

txtBox3.Text=result.ToString();

}

将txtBox2的AutoPostBack属性设置为true，当txtBox2中的值发生改变时自动提交数据到服务器

如果想要txtBox3只能看不能进行操作的话，就需要添加：Enabled=true; /ReadOnly=true;