Click here to Skip to main content
15,915,164 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Posted
Updated 5-Apr-17 23:45pm
Comments
Karthik_Mahalingam 18-Oct-16 4:34am    
convert the a tag to asp hyperlink control

I think I understand the question:

The simplest way to get a value from "code behind" into the "markup" is to simply run the element server side. You can do this with any element:

ASP.NET
<a runat="server" ID="myAnchor" href="#" class="inner"></a>


then it will appear in the code behind:
VB
myAnchor.HRef = "somevalue";


or something similar - My VB is very rusty
 
Share this answer
 
Comments
Le Van Phu 17-Oct-16 5:33am    
this code not id !!
code just is: href="value" class="inner"
Andy Lanng 17-Oct-16 5:34am    
Sorry, I didn't get that.
Le Van Phu 17-Oct-16 5:47am    
hihi! help me! we can get for class of a tag?
ex:
Andy Lanng 17-Oct-16 5:50am    
Sorry, but it's difficult to understand you. I'll do my best :S
Try using the asp:Hyperlink class
Here is the msdn page
A bit old question but it can help to someone.

Where WB is a WebBrowser Control:

For Each Ele As HtmlElement In WB.Document.GetElementsByTagName("a")
    If Ele.GetAttribute("class").Contains("inner") Then
        Dim s as String = Ele.GetAttribute("href")
    End If
Next
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900