Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Meta data: helpful for SEO (search engine optimization)
            Page.Title           = "Customer Details";
            Page.MetaKeywords    = "Customer Details, Patterns in Action";
            Page.MetaDescription = "Customer Details at Patterns in Action";

            if (!IsPostBack)
            {
                // Set the selected menu item in the Master page.
                SelectedMenu = "customers";

                CustomerId = int.Parse(Page.RouteData.Values["customerid"].ToString());

                // Set DetailsView control in Add or Edit mode.
                if (CustomerId == 0)
                {
                    DetailsViewCustomer.ChangeMode(DetailsViewMode.Insert);
                }
                else
                {
                    DetailsViewCustomer.ChangeMode(DetailsViewMode.Edit);
                }

                // Set image
                ImageCustomer.ImageUrl = imageService + "GetCustomerImageLarge/" + CustomerId;
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // Set the selected menu item in the Master page.
                Master.TheMenuInMasterPage.SelectedItem = "customers";

                CustomerId = int.Parse(Request["id"].ToString());

                // Set DetailsView control in Add or Edit mode.
                if (CustomerId == 0)
                {
                    DetailsViewCustomer.ChangeMode(DetailsViewMode.Insert);
                }
                else
                {
                    DetailsViewCustomer.ChangeMode(DetailsViewMode.Edit);
                }

                // Set image
                ImageCustomer.ImageUrl = imageService + "GetCustomerImageLarge/" + CustomerId;
            }
        }