protected void BindImages() { BPImages bpu = new BPImages(); DSImages = new BEImages(); if (FilterID != -1 && FilterID != 0) { DSImages.Merge(bpu.SelectAllByImageCategoryID(FilterID)); } else { DSImages.Merge(bpu.SelectAllWithImageCategories()); } int ImageCategoryID = -1; Boolean blnNew = true; StringBuilder returnImages = new StringBuilder(10000); returnImages.Append("none,No Image|"); foreach(DataRow dr in DSImages.tbl_Images.Rows) { if ((int) dr["ImageCategoryID"] != ImageCategoryID) { ImageCategoryID = (int) dr["ImageCategoryID"]; blnNew = true; } if (blnNew) { returnImages.Append(",-- " + dr["ImageCategoryName"] + " --|"); blnNew = false; } returnImages.Append(dr["ImageID"].ToString() + "," + HttpUtility.HtmlDecode(" ") + dr["ImageAlias"].ToString() + "|"); } lblScript.Text = "<script Language=\"Javascript\">window.parent.handleResponse('" + returnImages + "', 'Image')</script>"; }
protected void BindImages() { BPImages bpu = new BPImages(); DSImages = new BEImages(); if (ddlImageCategories.SelectedValue != "-1") { DSImages.Merge(bpu.SelectAllByImageCategoryID(Convert.ToInt32(ddlImageCategories.SelectedValue))); } else { DSImages.Merge(bpu.SelectAllWithImageCategories()); } int ImageCategoryID = -1; Boolean blnNew = true; ddlImages.Items.Clear(); ddlImages.Items.Add(new ListItem("No Image", "0")); foreach(DataRow dr in DSImages.tbl_Images.Rows) { if ((int) dr["ImageCategoryID"] != ImageCategoryID) { ImageCategoryID = (int) dr["ImageCategoryID"]; blnNew = true; } if (blnNew) { ddlImages.Items.Add(new ListItem("-- " + dr["ImageCategoryName"] + " --", "")); blnNew = false; } ddlImages.Items.Add(new ListItem(HttpUtility.HtmlDecode(" ") + dr["ImageAlias"].ToString(), dr["ImageID"].ToString())); } if (SelectedImage != 0) { ddlImages.SelectedValue = SelectedImage.ToString(); } }