Retrieve value from attribute in HTML tag in asp.NET
I have a large string containing a custom HTML tag (xxx). The tag also has two attributes.
How would I retrieve the value of the two attributes and then place the tag and its content with a new string derived from th开发者_运维问答ose two attributes?
Thanks for your time.
Where do you want to retrieve it? In the code behind?
If your tag is runat="server", you can do:
mytag.Attributes["nameofmyattribute"]
If its in string then you should consider using HTML Agility Pack. However it may be overkill so show us some sample string... maybe only some RegEx can do it.
精彩评论