Friday, August 20, 2010

ASP.Net C# Trim Method?

For example, I have 24.00 on my Table.





If I use a session variable and put it on a textbox, I only want the 24 to appear. But I don't want to change its format on the DataGrid. So I'm thinking of trimming the .00 at the end. How do I put it in code?





I think it's something like this:


TextBox1.Text.Trim()???


But I don't know how to use it.ASP.Net C# Trim Method?
text.trim only trims the spaces off the front and back. What you might want to do is used a 'masked text box' and set the mask only to non decimal places.





outside of that you will have to search the string for a period and take the substring from the start of the string to the period, but not including the period.

No comments:

Post a Comment