selvi subramanian

selvi subramanian

  • NA
  • 799
  • 571.7k

how to give the textbox value in text as 14.5/100 as default

Aug 20 2013 2:13 AM
how to give the textbox value in text as 14.5/100 as default


in textbox i  use default value as (14.5/100) i never give the value in run time 


i need to multiply the value with next textbox . given  value in  source code .


need to multiply the default value in source code 





my design is 



    <table class="style1">
        <tr>
            <td>
                a</td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                b</td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server" ontextchanged="TextBox2_TextChanged" AutoPostBack="true"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                a+b</td>
            <td>
                <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                mul</td>
            <td>
                <asp:TextBox ID="TextBox4" runat="server" ontextchanged="TextBox4_TextChanged" 
                    AutoPostBack="True"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                multl</td>
            <td>
                <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
            </td>
        </tr>

</table>



my coding is 



using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class math : System.Web.UI.Page
{

    REMO sel = new REMO();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        
      
       // float c= float.Parse(TextBox1.Text) + float.Parse(TextBox2.Text);
       //TextBox3.Text = Convert.ToString(c);



        //float s = c * float.Parse(TextBox4.Text);

        //float s = ((c * float.Parse(TextBox4.Text)));
        //TextBox5.Text = Convert.ToString(s);

       
      
    }
    protected void TextBox4_TextChanged(object sender, EventArgs e)
    {
        double guna = int.Parse(TextBox3.Text) * (14.5 / 100);
        TextBox5.Text = Convert.ToString(guna);
       
        
    }
    protected void TextBox2_TextChanged(object sender, EventArgs e)
    {
        float c = float.Parse(TextBox1.Text) + float.Parse(TextBox2.Text);
        TextBox3.Text = Convert.ToString(c);

    }
}












textbox3* textbox4 as default value (14.5/100) =textbox5










in run time i given the value as 14.5/100 my coding is working but. i need textbox4 value as default text as 14.5/100 used in source code. multiply with textbox3. and need to show the output in textbox5

Answers (15)