You must Sign In to post a response.
  • Category: ASP.NET

    How to use delimiter in textbox in

    in a textbox in run time if i put 1000 means if i enter 1000 i need to show like this 1,000 in the textbox in runtime
  • #767357

    OnKeyPress event of textbox you can wrote below lines of code

    Protected void txt1_KeyPress(object sender, KeyPressEventArgs e)
    e.Handled =!char.IsDigit(e.KeyChar) && e.KeyChar !=(char)8;
    txt1.Text=string.Format("{0:n0}", Double.Parse(txt1.Text));

    Hope this will helpful to you...

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #767377
    try this code

    Text='<%# string.Format(CultureInfo.InvariantCulture, "{0:#,0.00}", Bind("Budget")) %>'

    refer his url


    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #767378
    when you assign a value to textbox you can use 'string.Format' method, it just Converts the value of objects to strings based on the formats specified and inserts them into another string

    textBox1.Text = string.Format("{0:#,##0.00}", double.Parse(textBox1.Text));

    above code will works as expected just you need to make sure that input text should be only Integer or Double value
    or simply you can use globalization as Indian, see below snippet

    textBox1.Text = string.Format(System.Globalization.CultureInfo.GetCultureInfo("id-ID"), "{0:#,##0.00}", double.Parse(textBox1.Text));

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • Sign In to post your comments