baked
baked

Reputation: 245

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 those two attributes?

Thanks for your time.

Upvotes: 1

Views: 8118

Answers (2)

Shekhar_Pro
Shekhar_Pro

Reputation: 18430

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.

Upvotes: 1

renanleandrof
renanleandrof

Reputation: 7017

Where do you want to retrieve it? In the code behind?

If your tag is runat="server", you can do:

mytag.Attributes["nameofmyattribute"]

Upvotes: 3

Related Questions