Peter
Sat Jun 25 07:41:15 CDT 2005
"Prasad Dannani" <prasad@pennywise.com> wrote in message
news:Oa2m7ZSeFHA.3620@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I have a Double Value. i am planning to display it in "0.0000" format i.e.
> the decimals length is fixed i.e. 4.
>
> I am using math.round function which is reducing the length to 4. but if
> the
> length is just 2 digits then it is giving 2 digits only. where i want 4
> digits.
>
> Can anyone help me out. I done this functionality in visual basic but now
> i
> want it for c#.net
>
> Thanks in advance
> Prasad Dannani
>
>
If you are using Visual Studio, search your MSDN help for "BoundColumn".
You'll find articles/examples in C# that illustrate use of the
DataFormalString property.
Or, on the web:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolsboundcolumnclassdataformatstringtopic.asp
The following excerpt may be helpful:
Use the DataFormatString property to provide a custom format for the items
in the column.
The data format string consists of two parts, separated by a colon, in the
form { A: Bxx }. For example, the formatting string {0:F2} displays a
fixed-point number with two decimal places.
Note The entire string must be enclosed in braces to indicate that it is
a format string and not a literal string. Any text outside the braces is
displayed as literal text.
--
Peter [MVP Visual Developer]
Jack of all trades, master of none.