I want the below format to be done from my codebehind:
<a href="">
<img src=""/>
</a>
I have done this way but I am not able to add image to <a href>
Can anyone say me how to do that?
Here is my code:
Dim urls As New List(Of String)
urls.Add("Downloads/" & Session("tempDir").ToString & "/" & filename)
For Each imageURL As String In urls
Dim img = New System.Web.UI.WebControls.Image()
img.ImageUrl = imageURL
img.Attributes.Add("src", "Downloads/" & Session("tempDir").ToString & "/" & filename)
img.Attributes.Add("rel", "group2")
img.Width = 75
img.Height = 50
img.CssClass = "clickImage"
img.ImageAlign = HorizontalAlign.Left
Me.FinalPreview.Controls.Add(img)
Next
I have found this:
Dim anchor As New HtmlGenericControl("a")
anchor.Attributes.Add("href", "#")
But I am not able to understand how do I add img to this If I add control the total img is not showing up.
You can do it using
LiteralcontrolPlace a literal control on the page and then add its text like this…