protected void Page_Load(object sender, EventArgs e) { m_jobId = Convert.ToInt32(Request.QueryString["jobId"]); if (Request.QueryString["SourceJobJobId"] == "undefined") { // Check for possiblity of updating existing links. Facade.IJob facJob = new Facade.Job(); m_dsLinkedLegs = facJob.GetJobsLinks(m_jobId); if (m_dsLinkedLegs.Tables[0].Rows.Count > 0) { m_sourceJobId = (int)m_dsLinkedLegs.Tables[0].Rows[0]["JobId"]; m_sourceInstructionId = (int)m_dsLinkedLegs.Tables[0].Rows[0]["SourceInstructionId"]; if (!IsPostBack) { chkLinkDriver.Checked = (bool)m_dsLinkedLegs.Tables[0].Rows[0]["LinkDriver"]; chkLinkVehicle.Checked = (bool)m_dsLinkedLegs.Tables[0].Rows[0]["LinkVehicle"]; chkLinkTrailer.Checked = (bool)m_dsLinkedLegs.Tables[0].Rows[0]["LinkTrailer"]; } } } else { m_sourceJobId = Convert.ToInt32(Request.QueryString["SourceJobJobId"]); m_sourceInstructionId = Convert.ToInt32(Request.QueryString["SourceJobInstructionId"]); } if (m_sourceJobId == 0 || m_sourceInstructionId == 0) { pnlLinkJobs.Visible = false; pnlError.Visible = true; btnConfirm.Visible = false; } else if (!IsPostBack) { BindLegs(); } }