void LoadAdPost() { YardeCartData.UserAdpost ad = new YardeCartData.UserAdpost(); ad.AdPostId=Convert.ToInt32(strAdpostId); ad.UserId=Convert.ToInt32(strUserId); dt = objYser.GetAdDetailsDT(ad); 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; } txtShowDate.Value = Convert.ToDateTime(dt.Rows[0]["AdTillDate"].ToString()).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]; } }
public void BindUrl() { VisibleNoImage(); string sImageHtml = ""; string appPath = ConfigurationManager.AppSettings["ApplicationPath"].ToString().Trim(); YardeCartData.UserAdpost objad = new YardeCartData.UserAdpost(); objad.AdPostId = Convert.ToInt32(strAdpostId); objad.UserId = Convert.ToInt32(strUserId); dt = objYser.GetAdDetailsDT(objad); 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; }