Ejemplo n.º 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int parentID = 0;

        parentID = int.Parse(ddlParentID.SelectedValue);
        Category cat = new Category(int.Parse(lblID.Text));

        cat.CategoryName = txtCategoryName.Text;
        cat.ImageFile    = ImagePicker1.GetSelectedImage();
        //reset the image file to use virtual root reference
        string imageFile = System.IO.Path.GetFileName(cat.ImageFile);

        cat.ImageFile = "~/images/pageheaders/" + imageFile;

        cat.ListOrder        = int.Parse(txtListOrder.Text);
        cat.ShortDescription = txtShortDescription.Text;
        cat.LongDescription  = txtLongDescription.Text;
        cat.ParentID         = parentID;
        cat.Save(Utility.GetUserName());

        LoadCategory(cat.CategoryID);
        LoadCatBox();

        //Reload the master category list
        CategoryController.Load();
    }
Ejemplo n.º 2
0
    void LoadCategory(int categoryID)
    {
        btnDelete.Attributes.Add("onclick", "return CheckDelete();");
        Category cat = new Category(categoryID);

        txtCategoryName.Text     = cat.CategoryName;
        txtLongDescription.Text  = cat.LongDescription;
        txtShortDescription.Text = cat.ShortDescription;
        txtListOrder.Text        = cat.ListOrder.ToString();
        lblID.Text = cat.CategoryID.ToString();
        ddlParentID.SelectedValue = cat.ParentID.ToString();

        //this is a hack - Atlas doesn't respect the ViewState for some reason
        ImagePicker1.ImageFolder = "images/pageheaders";

        ImagePicker1.SetImage(cat.ImageFile);
    }