‘m using the ad-Gallery code in my asp.net application.
I’ve changed it a bit to be generic, because I wanted to download pictures from my database.
It means that all the implementation is in the code behind (here’s a piece of my C# code):
ul.Attributes.Add("class", "ad-thumb-list");
tabs.Controls.Add(ul);
int i = 1;
foreach (Products item in _PicturesPage)
{
ul.Controls.Add(li);
anchor.Attributes.Add("href", item.ImagePath);
image.Attributes.Add("src", "../Images/pictures/thumbs/"+i+".jpg");
image.Attributes.Add("title","A title for 12.jpg");
image.Attributes.Add("alt", "This is a nice, and incredibly descriptive, description of the image");
image.Attributes.Add("class","image3");
li.Controls.Add(anchor);
anchor.Controls.Add(image);
i++;
}
I want to know if it’s possible to intercept a click in one of the hyperlink ()?
Thank you 🙂
Just add a JavaScript event handler:
Be sure to return
falsefrom the handler, if you want to prevent navigation to the link’shref.If
anchoris an instance ofHtmlAnchoryou can use: