Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     errormsgs.Clear();
     Message.DataSource = null;
     Message.DataBind();
     if (!Page.IsPostBack)
     {
         //errormsgs.Add("IsPostBack = False");
         //LoadMessageDisplay(errormsgs, "alert alert-info");
         //pagenum = Request.QueryString["page"];
         pid = Request.QueryString["pid"];
         add = Request.QueryString["add"];
         BindSchoolList();
         if (string.IsNullOrEmpty(pid))
         {
             Response.Redirect("~/Default.aspx");
         }
         else if (add == "yes")
         {
             UpdateButton.Enabled = false;
             DeleteButton.Enabled = false;
         }
         else
         {
             AddButton.Enabled = true;
             ProgramController sysmgr = new ProgramController();
             Programs          info   = null;
             info = sysmgr.FindByPKID(int.Parse(pid));
             if (info == null)
             {
                 errormsgs.Add("Record is not in Database.");
                 LoadMessageDisplay(errormsgs, "alert alert-info");
                 Clear(sender, e);
             }
             else
             {
                 ProgramID.Text            = info.ProgramID.ToString();
                 ProgramName.Text          = info.ProgramName;
                 DiplomaName.Text          = info.DiplomaName;
                 SchoolList.SelectedValue  = info.SchoolCode;
                 Tuition.Text              = info.Tuition.ToString();
                 InternationalTuition.Text = info.InternationalTuition.ToString();
             }
         }
     }
     //else
     //{
     //    errormsgs.Add("IsPostBack = True");
     //}
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         pagenum = Request.QueryString["page"];
         pid     = Request.QueryString["pid"];
         add     = Request.QueryString["add"];
         BindSchoolList();
         if (string.IsNullOrEmpty(pid))
         {
             Response.Redirect("~/Default.aspx");
         }
         else if (add == "yes")
         {
             UpdateButton.Enabled = false;
             DeleteButton.Enabled = false;
         }
         else
         {
             AddButton.Enabled = false;
             ProgramController sysmgr = new ProgramController();
             Programs          info   = null;
             info = sysmgr.FindByPKID(int.Parse(pid));
             if (info == null)
             {
                 ShowMessage("Record is not in Database.", "alert alert-info");
                 Clear(sender, e);
             }
             else
             {
                 ID.Text          = info.ProgramID.ToString(); //NOT NULL in Database
                 ProgramName.Text = info.ProgramName;          //NOT NULL in Database
                 if (info.DiplomaName == null)                 //NULL in Database
                 {
                     DiplomaName.Text = "";
                 }
                 else
                 {
                     DiplomaName.Text = info.DiplomaName;
                 }
                 SchoolList.SelectedValue  = info.SchoolCode;
                 Tuition.Text              = string.Format("{0:0.00}", info.Tuition.Value);
                 InternationalTuition.Text = string.Format("{0:0.00}", info.InternationalTuition.Value);
             }
         }
     }
 }