Esempio n. 1
0
        private void Detail(int recipeId)
        {
            var view      = new RecipeDetailView();
            var viewmodel = new RecipeDetailViewModel(recipeId);

            view.DataContext = viewmodel;
            view.Show();
        }
    protected void RecipeDetailView_ModeChanging(object sender, DetailsViewModeEventArgs e)
    {
        //// Save the category of the visualized recipe
        //Label labelCategoryName =
        //   (Label)RecipeDetailView.FindControl("Category");
        //string categoryName = labelCategoryName.Text;

        // Change current mode to the selected one
        RecipeDetailView.ChangeMode(e.NewMode);
        // Rebind the grid
        BindDetails();

        //// set the selected value of the dropdown list to the actual category of the recipe
        //DropDownList newCategoryDropDownList =
        //   (DropDownList)RecipeDetailView.FindControl("editCategoryDropDownList");

        //for (int i = 0; i < newCategoryDropDownList.Items.Count; i++)
        //{
        //    if (newCategoryDropDownList.Items[i].ToString() == categoryName)
        //    {
        //        newCategoryDropDownList.SelectedValue = (i + 1).ToString();
        //    }
        //}
    }