Example #1
0
        void LoadAdDetails()
        {
            AdDetailsBll adbll = new AdDetailsBll();
            DataTable    dt    = adbll.GetAdDetails(Convert.ToInt32(strAdId), Convert.ToInt32(strUserId));

            if (dt.Rows.Count > 0)
            {
                lblCategory.Text = dt.Rows[0]["CategoryName"].ToString();
                lbllAdtitle.Text = dt.Rows[0]["AdPostTitle"].ToString();
                lblAddesc.Text   = dt.Rows[0]["Description"].ToString();
                lblPrice.Text    = "Price : $" + dt.Rows[0]["Price"].ToString();
                strImgpath       = dt.Rows[0]["ImagePath"].ToString().Split(':');
                strVideolink     = dt.Rows[0]["VideoLink"].ToString();

                string appPath  = ConfigurationManager.AppSettings["ApplicationPath"].ToString().Trim();
                string imageUrl = appPath + strImgpath[0];
                adimage1.InnerHtml = string.Format(
                    "<a align=center href='{0}'><br/><img  align=center src='{0}' " +
                    "width=350px  height=450px  alt='' border=2 bordorcolor='black'></a>",
                    imageUrl);
                for (int intCnt = 1; strImgpath.Length > intCnt; intCnt++)
                {
                    imageUrl = appPath + strImgpath[intCnt];
                }

                if (strImgpath.Length >= 2)
                {
                    imageUrl           = appPath + strImgpath[1];
                    adimage2.InnerHtml = string.Format(
                        "<a align=center href='{0}'><br/><img  align=center src='{0}' " +
                        "width=200px  height=200px  alt='' border=2 bordorcolor='black'></a>",
                        imageUrl);
                }
                if (strImgpath.Length >= 3)
                {
                    imageUrl           = appPath + strImgpath[2];
                    adimage3.InnerHtml = string.Format(
                        "<a align=center href='{0}'><br/><img  align=center src='{0}' " +
                        "width=200px  height=200px  alt='' border=2 bordorcolor='black'></a>",
                        imageUrl);
                }
                if (strImgpath.Length >= 4)
                {
                    imageUrl           = appPath + strImgpath[3];
                    adimage4.InnerHtml = string.Format(
                        "<a align=center href='{0}'><br/><img  align=center src='{0}' " +
                        "width=200px  height=200px  alt='' border=2 bordorcolor='black'></a>",
                        imageUrl);
                }
                if (strImgpath.Length == 5)
                {
                    imageUrl           = appPath + strImgpath[4];
                    adimage5.InnerHtml = string.Format(
                        "<a align=center href='{0}'><br/><img  align=center src='{0}' " +
                        "width=200px  height=200px  alt='' border=2 bordorcolor='black'></a>",
                        imageUrl);
                }
                spnVideo.InnerHtml = BindUrl(strVideolink);
            }
        }
        void LoadAdPost()
        {
            AdDetailsBll adbll = new AdDetailsBll();

            dt = adbll.GetAdDetails(Convert.ToInt32(strAdpostId), Convert.ToInt32(strUserId));
            if (dt.Rows.Count > 0)
            {
                txtTitle.Text    = dt.Rows[0]["AdPostTitle"].ToString();
                txtDesc.Text     = dt.Rows[0]["Description"].ToString();
                txtKeywords.Text = dt.Rows[0]["Keywords"].ToString();
                txtPrice.Text    = dt.Rows[0]["Price"].ToString();
                txtVidolink.Text = dt.Rows[0]["VideoLink"].ToString();
                //strImagePath = dt.Rows[0]["ImagePath"].ToString().Split(':');
                strAllImgPath = dt.Rows[0]["ImagePath"].ToString();
                strImageId    = dt.Rows[0]["ImageId"].ToString();

                for (int i = 0; i < ddlCategory.Items.Count; i++)
                {
                    if (ddlCategory.Items[i].Text == dt.Rows[0]["CategoryName"].ToString())
                    {
                        ddlCategory.SelectedIndex = i;
                    }
                }
                DatePicker1.SelectedDate = Convert.ToDateTime(dt.Rows[0]["AdTillDate"].ToString());
                //HtmlGenericControl spnHtml = (HtmlGenericControl)this.Page.FindControl("spnAdImag");
                //if (spnHtml == null)
                //    return;

                BindUrl();
                //img1.Src = strImagePath[0];
                //remove1.Attributes.Add("imgpath", strImagePath[0]);
                //fileuploadImg = strImagePath[0];
            }
        }
Example #3
0
        private void LoadImage()
        {
            try
            {
                AdDetailsBll adbll = new AdDetailsBll();
                DataTable    dt    = adbll.GetAdDetails(Convert.ToInt32(strAdId), Convert.ToInt32(strUserId));

                if (dt.Rows.Count > 0)
                {
                    lblCategory.Text = dt.Rows[0]["CategoryName"].ToString();
                    lblTitle.Text    = dt.Rows[0]["AdPostTitle"].ToString();
                    lblAddesc.Text   = dt.Rows[0]["Description"].ToString();
                    lblPrice.Text    = "Price : $" + dt.Rows[0]["Price"].ToString();
                    strImgpath       = dt.Rows[0]["ImagePath"].ToString().Split(':');
                    strVideolink     = dt.Rows[0]["VideoLink"].ToString();
                }
                string appPath = ConfigurationManager.AppSettings["ApplicationPath"].ToString().Trim();

                string divSlider = @"<ul class='slides'>";
                string fileSlide = string.Empty;

                for (int i = 0; i < strImgpath.Length; i++)
                {
                    fileSlide = @"<li><img src='";

                    fileSlide += strImgpath[i] + "' /></li>";

                    divSlider += fileSlide;
                }

                divImageSlider.InnerHtml = divSlider + "</ul>";
                spnVideo.InnerHtml       = BindUrl(strVideolink);
            }
            catch (Exception ex)
            {
                //ShowErrorMsg("error", ex.Message);
            }
        }
        public void BindUrl()
        {
            VisibleNoImage();
            string       sImageHtml = "";
            string       appPath    = ConfigurationManager.AppSettings["ApplicationPath"].ToString().Trim();
            AdDetailsBll adbll      = new AdDetailsBll();

            dt = adbll.GetAdDetails(Convert.ToInt32(strAdpostId), Convert.ToInt32(strUserId));
            if (dt.Rows.Count > 0)
            {
                strAllImgPath = dt.Rows[0]["ImagePath"].ToString();
                if (strAllImgPath.Trim() != "")
                {
                    strImagePath = dt.Rows[0]["ImagePath"].ToString().Split(':');
                }
            }
            if (strImagePath.Length >= 1 && strImagePath[0] != null && strImagePath[0] != "")
            {
                img1.Src        = strImagePath[0];
                img1.Visible    = true;
                remove1.Visible = true;
                remove1.Attributes.Add("imgpath", strImagePath[0]);
            }
            if (strImagePath.Length >= 2 && strImagePath[1] != null)
            {
                img2.Src        = strImagePath[1];
                img2.Visible    = true;
                remove2.Visible = true;

                remove2.Attributes.Add("imgpath", strImagePath[1]);
            }
            if (strImagePath.Length >= 3 && strImagePath[2] != null)
            {
                img3.Src        = strImagePath[2];
                img3.Visible    = true;
                remove3.Visible = true;

                remove3.Attributes.Add("imgpath", strImagePath[2]);
            }
            if (strImagePath.Length >= 4 && strImagePath[3] != null)
            {
                img4.Src        = strImagePath[3];
                img4.Visible    = true;
                remove4.Visible = true;

                remove4.Attributes.Add("imgpath", strImagePath[3]);
            }
            if (strImagePath.Length >= 5 && strImagePath[4] != null)
            {
                img5.Src        = strImagePath[4];
                img5.Visible    = true;
                remove5.Visible = true;

                remove5.Attributes.Add("imgpath", strImagePath[4]);
            }

            //sImageHtml = "<table height='100px' width='500px'><tr><td>";
            //for (int i = 0; i < strImgPath.Length; i++)
            //{
            //    sImageHtml += "<img src='" + strImgPath[i] + "' height='60px' width='50px'><a id='remImg" + i.ToString() + "' href='#' onclick=''>Remove</a>";
            //}
            //sImageHtml += "</td></tr><table>";
            //return sImageHtml;
        }