Пример #1
0
        protected void Application_Error(object sender, EventArgs e)
        {
            //get the last error
            Exception objError = Server.GetLastError();

            if (objError is HttpException)
            {
                //if objError.
            }
            //redirect to the error page
            CException.EmailException(objError);
            Response.Redirect("/error.aspx?handler=global");
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //use ef to fill the grid
                using (MarcDatabase objEnt = new MarcDatabase())
                {
                    var data = from Product in objEnt.Products
                               select Product;

                    //fill the grid
                    grdProducts2.DataSource = data.ToList();
                    grdProducts2.DataBind();
                }
            }
            catch (Exception objError)
            {
                CException.EmailException(objError);
                Response.Redirect("error.aspx");
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //use ef to fill the grid
                using (NorthwindEntities objEnt = new NorthwindEntities())
                {
                    var data = from Supplier in objEnt.Suppliers
                               select Supplier;

                    //fill the grid
                    grdSuppliers.DataSource = data.ToList();
                    grdSuppliers.DataBind();
                }
            }
            catch (Exception objError)
            {
                CException.EmailException(objError);
                Response.Redirect("error.aspx");
            }
        }