Textbox RRS feed

  • Question

  • User-797751191 posted


      I have textbox in which amount is entered. I want if user has entered 12000 means no decimal, it should get converted to 12000.00

    Secondly can it also get converted with thousand separator


    Wednesday, July 10, 2019 5:22 PM


  • User288213138 posted

    Hi jsshivalik,

    According to your description, I wrote a demo for you as reference.

    The ToString() method returns a string "("#,##0.00")" for this object.

    Note: You need to set the property of the TextBox control AutoPostBack="true". Because its value need interact with the server.

    The code:

    <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged" AutoPostBack="true"></asp:TextBox>
    protected void TextBox1_TextChanged(object sender, EventArgs e)
                if (!string.IsNullOrEmpty(TextBox1.Text.ToString()))
                    String Input = TextBox1.Text;

    The result:

    Best regards,


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 11, 2019 2:48 AM

All replies