Hai,
I am creating a asp repeater for displaying images dynamically. The asp Repeater is created from server side. I have used asp image for displaying the image in the repeater. Now i have to show the tooltip for each image. The tooltip contains that same image in LargeSize. I created the repeater dynamically.
Also dynamically add the image control in repeater. I used the Itemtemplate for add the asp image control. Now i have to show the tooltip for each image dynamically. How can i add this tooltip fro this images, which is added in template.
I added the code below.
But it is not working.
Thanks
Velkumar.
I am creating a asp repeater for displaying images dynamically. The asp Repeater is created from server side. I have used asp image for displaying the image in the repeater. Now i have to show the tooltip for each image. The tooltip contains that same image in LargeSize. I created the repeater dynamically.
Also dynamically add the image control in repeater. I used the Itemtemplate for add the asp image control. Now i have to show the tooltip for each image dynamically. How can i add this tooltip fro this images, which is added in template.
I added the code below.
protected Repeater ImageRepeater;
ImageRepeater.ItemTemplate = new ImageTemplate();
ImageRepeater.DataSource = ImageTable;
ImageRepeater.DataBind();
class ImageTemplate : ITemplate
{
Image ToolImg ;
RadToolTip ImgToolTip;
public ImageTemplate()
{ }
public void InstantiateIn(System.Web.UI.Control container)
{
Image Img = new Image ();
ToolImg = new Image ();
Img.DataBinding += new EventHandler(Img_DataBinding);
LiteralControl StartDiv = new LiteralControl("<
div
style=\"float: left; padding-left:10px;\">");
container.Controls.Add(StartDiv);
container.Controls.Add(Img);
ImgToolTip = new RadToolTip();
ImgToolTip.Width = Unit.Pixel(300);
ImgToolTip.Height = Unit.Pixel(300);
ImgToolTip.TargetControlID= Img.ClientID;
ImgToolTip.IsClientID = true;
ImgToolTip.Controls.Add(ToolImg);
container.Controls.Add(ImgToolTip);
LiteralControl EndDiv = new LiteralControl("</
div
>");
container.Controls.Add(EndDiv);
}
void Img_DataBinding(object sender, EventArgs e)
{
Image Img;
Img = (Image )sender;
RepeaterItem container = (RepeaterItem)Img.NamingContainer;
Img.ImageUrl = "/_layouts/images/jobsarathyDemo/TempImages/"+DataBinder.Eval(container.DataItem, "ImageName").ToString();
ToolImg.ImageURL = "/_layouts/images/jobsarathyDemo/TempImages/" + DataBinder.Eval(container.DataItem, "ImageName").ToString();
}
}
But it is not working.
Thanks
Velkumar.