Alex Leon

Alex Leon

  • NA
  • 3
  • 0

Format Double

Jun 30 2009 2:24 PM

Needed some help with the following code. I am trying to format the result to a decimal ##0.00  this is the first time I am trying to work with C# and need some help. Thank you
I have tried to modify the code and I just can't get this correct.
 
            if (this.DataSource.BalanceSpecified) {
                     
                string formattedValue = this.DataSource.Format(TblPaymentRequestTable.Balance);
                formattedValue = HttpUtility.HtmlEncode(formattedValue);
                if(formattedValue != null){
                   
                    int maxLength = formattedValue.Length;
                    if (maxLength > (int)(100.00)){
                        maxLength = (int)(100.00);
                       
                    }
                    if (maxLength == (int)(100.00)) {
                        formattedValue = NetUtils.EncodeStringForHtmlDisplay(formattedValue.Substring(0,maxLength));
                        formattedValue = formattedValue + "...";
                    }
                                      
                }                             
                   
                this.Balance.Text = formattedValue;
             
              
            } else { 
                this.Balance.Text = TblPaymentRequestTable.Balance.Format(TblPaymentRequestTable.Balance.DefaultValue);
                           
            }
 

Answers (3)