Click here to Skip to main content
12,244,664 members (52,266 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
i have tow text boxes when i entered the values in the page the result should be displayed in the same page
Posted 4-Oct-12 8:30am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

double num1, num2;
private void button1_Click(object sender, EventArgs e)
{
    num1 = Convert.ToDouble(textBox1.Text);
    num2 = Convert.ToDouble(textBox2.Text);
    label1.Text = Convert.ToString(num1 * num2);
}
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Friend, on button click event, take the value of both text box like TextBox1.Text and convert them into double/int data type, multiply both the textbox values and assign the value on label as "Label1.Text =(Convert.ToInt(TextBox1.Text)*Convert.ToInt(TextBox2.Text)).ToString();"

Thanks,
Ambesha
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

<body>
    <form id="form1" runat="server">
    <div>
    <asp:label id="lblNumber1" runat="server" text="Enter first value:" xmlns:asp="#unknown"></asp:label>

Now on code behind (test.aspx.cs):
----------------------------------
 protected void OnBtnMultiplicationClick(object sender, EventArgs e)
        {
            int num1=Convert.ToInt32(txtNumber1.Text);
            int num2 = Convert.ToInt32(txtNumber2.Text);
            lblMultiplication.Text = (num1 * num2).ToString();
 
        }
**Validation is not done so check for Null or empty value.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160426.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100