Example #1
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();
         //BindProgramList();
         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();
             Program           info   = null;
             info = sysmgr.FindByPGID(int.Parse(pid));
             if (info == null)
             {
                 ShowMessage("Record is not in Database.", "alert alert-info");
                 Clear(sender, e);
             }
             else
             {
                 PID.Text        = info.ProgramID.ToString(); //NOT NULL in Database
                 PName.Text      = info.ProgramName;          //NOT NULL in Database
                 DName.Text      = info.DiplomaName;
                 Tuition.Text    = info.Tuition.ToString();
                 IntTuition.Text = info.InternationalTuition.ToString();
                 if (info.SchoolCode != null) //NULL in Database
                 {
                     SchoolList.SelectedValue = info.SchoolCode.ToString();
                 }
                 else
                 {
                     SchoolList.SelectedValue = "0";
                 }
             }
         }
     }
 }