Пример #1
0
 /*************************************************************************
 *
 *                          GUI update methods
 *
 * ***********************************************************************/
 protected void ClearAllGridviews()
 {
     RecipeGridView.DataSource = null;
     RecipeGridView.DataBind();
     IngredientGridView.DataSource = null;
     IngredientGridView.DataBind();
     CategoryGridView.DataSource = null;
     CategoryGridView.DataBind();
     ContextGridView.DataSource = null;
     ContextGridView.DataBind();
     ltInstructions.Text = "Please select recipe to view recipe details.";
     Gv_imgs.DataSource  = null;
     Gv_imgs.DataBind();
 }
Пример #2
0
        protected void UpdateReceipeDetailsGridViews(int recipeId)
        {
            using (Models.PlanMyDinnerDbContext database = new Models.PlanMyDinnerDbContext())
            {
                IngredientGridView.DataSource = database.Recipes.Find(recipeId).Ingredients.ToList();
                IngredientGridView.DataBind();

                CategoryGridView.DataSource = database.Recipes.Find(recipeId).Categories.ToList();
                CategoryGridView.DataBind();

                ContextGridView.DataSource = database.Recipes.Find(recipeId).Contexts.ToList();
                ContextGridView.DataBind();

                ltInstructions.Text = addHtmlBreakTags(database.Recipes.Find(recipeId).Instructions);

                string          CurrentDir = new DirectoryInfo(Environment.CurrentDirectory).Parent.Parent.FullName;
                string          ImagePath  = System.IO.Path.Combine(CurrentDir, "Media/" + database.Recipes.Find(recipeId).ThumbFileName);
                List <ListItem> Imgs       = new List <ListItem>();
                string          ImgName    = Path.GetFileName(ImagePath);
                Imgs.Add(new ListItem(ImgName, "~/Media/" + ImgName));
                Gv_imgs.DataSource = Imgs;
                Gv_imgs.DataBind();
            }
        }