private void Page_Load(object sender, System.EventArgs e) { try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (Request.QueryString["id"] == null) { Session["lastpage"] = "admin_inspectschedules.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { InspectSchedId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "admin_inspectschedules.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } lblBack.Text = "<input type=button value=\" Back \" onclick=\"document.location='admin_inspectschedules.aspx'\">"; if (!IsPostBack) { inspect = new clsInspections(); inspect.iOrgId = OrgId; inspect.iInspectScheduleId = InspectSchedId; dgInspectSchedDetails.DataSource = new DataView(inspect.GetInspectSchedDetailsList()); dgInspectSchedDetails.DataBind(); lblScheduleName.Text = inspect.sInspectScheduleName.Value; hlAddInspection.NavigateUrl = "admin_inspectschedule_detail_edit.aspx?id=" + InspectSchedId.ToString() + "&detailid=0"; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = this.ParentPageURL; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (inspect != null) { inspect.Dispose(); } } }