p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 (http://p2p.wrox.com/forumdisplay.php?f=388)
-   -   onchenge in the textbox(Post back) (http://p2p.wrox.com/showthread.php?t=84569)

ddkdiiro August 3rd, 2011 05:21 AM

onchenge in the textbox(Post back)
Dear members,
I have encountered this problem for sometime but i have failed to get the solution. I have written my code below in C#.net wanting the Webform to automatically calculate the values from the textboxes as they are entered and displays them at the sametime in the result text box. As the user enters. Please go throu this problem below

================================================== =====
private void Qty_Init(object sender, System.EventArgs e)
this.Qty.AutoPostBack = true;
this.Qty.TextChanged += new System.EventHandler(Qty_TextChanged);
================================================== ========

private void Qty_TextChanged(object sender, System.EventArgs e)
Regex regex = new Regex("^[0-9]*&");
if(regex.IsMatch(this.Qty.Text) && !string.IsNullOrEmpty(this.Qty.Text.Trim()))
double Balance1;
double Amount1 = Convert.ToDouble(this.Qty.Text);
double Amount2 = Convert.ToDouble(this.Unit_Cost.Text);

Balance1 = Amount1 * Amount2;
this.AmountPaid.Text = Convert.ToString(Balance1);
//Balance1 = Convert.ToDouble(this.Balance.Text);


All times are GMT -4. The time now is 06:19 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.