Click here to Skip to main content
15,886,720 members
Articles / Web Development / IIS

Mobile Application Development in ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.93/5 (40 votes)
9 Apr 2010CPOL11 min read 291.5K   21.2K   62  
ASP.NET provide features to develop appllication for mobile devices. System.Web.Mobile namespace is devoted specifically to mobile Web development.
using System;
using System.Web.Mobile;
using System.Web.UI.MobileControls;
using System.Text;
using Microsoft.VisualBasic;

namespace STL.Web.Mobile.UI
{
    public partial class Loan_RepaymentCalculator : System.Web.UI.MobileControls.MobilePage
    {
        #region Event

        protected void Page_Load(object sender, EventArgs e)
        {
            Initialize();
        }

        protected void cmdRepayment_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid) return;
            try
            {
                Double dblPrincipal = double.Parse(this.PrincipalAmount.Text);
                Double dblApr = double.Parse(this.Rate.Text);
                Double dblMonthlyInterest = (Double)(dblApr / (12 * 100));
                Int64 intTermInMonths = Int64.Parse(this.Term.Text) * 12;
                Double dblMonthlyPayment;

                dblMonthlyPayment = Microsoft.VisualBasic.Financial.Pmt(dblMonthlyInterest, intTermInMonths, -dblPrincipal, 0, Microsoft.VisualBasic.DueDate.BegOfPeriod);

                this.ActiveForm = this.frmResult;

                StringBuilder sbDetailsSpec = new StringBuilder("");
                sbDetailsSpec.Append(String.Format("{0} @ {1}% for {2} years <br /> Payment: ", dblPrincipal.ToString("C0"), dblApr.ToString(), this.Term.Text));
                sbDetailsSpec.Append("<b>" + dblMonthlyPayment.ToString("C") + "</b>");
                this.tvLoanDetails.Text = sbDetailsSpec.ToString();
            }
            catch
            {
                this.ActiveForm = frmError;
            }
        }

        protected void cmdBack_Click(object sender, EventArgs e)
        {
            this.ActiveForm = this.frmInput;
        }

        #endregion Event

        #region Method

        private void Initialize()
        {
            this.frmInput.Title = UIConstant.TITLE_BAR;
            this.frmResult.Title = UIConstant.TITLE_BAR;
            this.frmError.Title = UIConstant.TITLE_BAR;

            this.lblHeading.Text = UIConstant.PAGE_TITLE;
            this.lblHeadingResult.Text = UIConstant.PAGE_TITLE;
            this.lblHeadingError.Text = UIConstant.PAGE_TITLE;
        }

        #endregion Method
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
Bangladesh Bangladesh
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions