protected void Page_Load(object sender, EventArgs e)
 {
     AppCode appcode = new AppCode();
     DataTable dt = appcode.DataTableSelectQuery("pic_update_category_select");
     DropDownList1.DataSource = dt;
     DropDownList1.DataBind();
 }
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     Panel1.Visible = true;
     DataTable dt = new DataTable();
     AppCode appcode = new AppCode();
     dt = appcode.DataTableSelectQuery("PictureGallery_Select", DropDownList1.SelectedValue, "category");
     DataList1.DataSource = dt;
     DataList1.DataBind();
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     AppCode appcode = new AppCode();
     int param1 = Convert.ToInt16(DropDownList1.SelectedValue);
     int parma2 = Convert.ToInt16(DropDownList2.SelectedValue);
     DataTable dt = appcode.DataTableSelectQuery("Calendar_Modify_Select", param1, "month", parma2, "year");
     DataList1.DataSource = dt;
     DataList1.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     Button3.Attributes["onclick"] = "recurrdatepop()";
     tbDateList.Visible = false;
     if (!Page.IsPostBack)
     {
         AppCode appcode = new AppCode();
         DataTable dt = appcode.DataTableSelectQuery("Calendar_Update_Icon_Select");
         DropDownList1.DataSource = dt;
         DropDownList1.DataBind();
     }
 }
 protected void Button4_Click(object sender, EventArgs e)
 {
     try
     {
         //AccessDataSource4.Insert();
         AppCode appcode = new AppCode();
         appcode.Query("pic_update_category_insert", "Category", TextBox2.Text);
     }
     catch (Exception)
     {
     }            
     // Notify the user that the category is uploaded ... 
     ClientScriptManager cs3 = Page.ClientScript;
     Type cstype3 = this.GetType();
     if (!cs3.IsStartupScriptRegistered(cstype3, "CategorySuccess"))
     {
         string s = "<script language=\"JScript\">window.alert('The new Picture Category was added successfully.');</script>";
         ClientScript.RegisterStartupScript(cstype3, "CategorySuccess", s);
     }
     TextBox2.Text = "";
     AppCode appcode1 = new AppCode();
     DataTable dt = appcode1.DataTableSelectQuery("pic_update_category_select");
     DropDownList1.DataSource = dt;
     DropDownList1.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         AppCode appcode = new AppCode();
         DataTable dt = appcode.DataTableSelectQuery("pic_update_category_select");
         DropDownList1.DataSource = dt;
         DropDownList1.DataBind();
         DataTable dt1 = appcode.DataTableSelectQuery("pic_mod_recent_select");
         DataList3.DataSource = dt1;
         DataList3.DataBind();
         DataTable dt2 = appcode.DataTableSelectQuery("pic_mod_home_select");
         DataList2.DataSource = dt2;
         DataList2.DataBind();
         DataTable dt3 = appcode.DataTableSelectQuery("pic_mod_icon_select");
         DataList1.DataSource = dt3;
         DataList1.DataBind();
     }
 }
 protected void Button4_Click(object sender, EventArgs e)
 {
     //AccessDataSource4.Delete();
     AppCode appcode1 = new AppCode();
     appcode1.Query("pic_mod_category_delete", "ID", DropDownList1.SelectedValue);
     DataTable dt1 = appcode1.DataTableSelectQuery("pic_update_category_select");
     DropDownList1.DataSource = dt1;
     DropDownList1.DataBind();
 }
        protected void DataList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            int ControlIndex = this.DataList2.SelectedIndex;
            //Find the Image Control in the selected Datalist Colum
            DataListItem dli = this.DataList2.Controls[ControlIndex] as DataListItem;
            Image MyImage = dli.FindControl("Image2") as Image;
            //Grab the ImageUrl for this picture.
            string MyImagePath = MyImage.ImageUrl;
            //Delete the actual image file.
            string ActualImagePath = Server.MapPath(MyImagePath);
            System.IO.File.Delete(ActualImagePath);
            //Delete the original image file.
            string OrignialImageName = "";
            string[] split = MyImagePath.Split(new Char[] { '/' });
            foreach (string s in split)
            {
                if (s.Trim().Contains(".jpg"))
                {
                    OrignialImageName = s;
                }
            }
            string OriginalImagePath = Server.MapPath("~/images/PictureGallery/Original_HomePic/" + OrignialImageName);
            //Delete the image information from the database.
            //AccessDataSource2.DeleteParameters.Add("FilePath", MyImagePath);
            //AccessDataSource2.Delete();
            try
            {
                AppCode appcode2 = new AppCode();
                appcode2.Query("pic_mod_home_delete", "ImagePath", MyImagePath);
                DataTable dt1 = appcode2.DataTableSelectQuery("pic_mod_home_select");
                DataList2.DataSource = dt1;
                DataList2.DataBind();
            }
            catch (Exception)
            {

            }
        }