Akshay

Akshay

  • NA
  • 82
  • 46.9k

on click HtmlImage i want to open new url & display item

Nov 6 2014 2:47 AM
i have code link this

          HtmlAnchor imganchor = new HtmlAnchor();
   imganchor.Attributes.Add("href", "http://www.google.com");
  HtmlImage image = new HtmlImage("div");
  image.InnerHtml = item["QuickLinkIcon"] != null && item["QuickLinkIcon"].ToString() != string.Empty ? item["QuickLinkIcon"].ToString() : "";
 
  imganchor.Controls.Add(image);
  captionDiv.Controls.Add(imganchor);


above where i mark link with color ,on that line i want to bind custom url that all ready present in list

so i write code for that like






  HtmlAnchor link = new HtmlAnchor();
  string url = item["URL"] != null && item["URL"].ToString() != string.Empty ? item["URL"].ToString() : "#";
  string[] urls= url.Split(',');
  link.HRef=urls[0].Trim(' ');
  link.Attributes.Add("class","link");
  captionDiv.Controls.Add(link);

now i want to bind this custom link to imganchor