I'm wondering if there is a way to insert an attribute inside a script tag without using the MergeAttributes or MergeAttribute method of the TagBuilder class.
I have a list of attribute data:
AttributeDataList = new List<AttributeData>
{
new AttributeData()
{
Key = "",
Value = ""
}
},
And in my helper, in charge of creating the script, I have this check:
if (script.AttributeDataList.Count > 0)
{
foreach (var attr in script.AttributeDataList)
{
scriptTag.MergeAttribute(attr.Key, attr.Value);
}
}
Now suppose I want insert the "async" or "defer" attribute without using "async=async", how can I do that? The TagBuilder class seems not offers such method, and what I obtain is async=""
I was thinking to use a regex, and replace the '=""' with " ", but this pattern @"=\\""" seems not working.
There is a solution for that? Many Thanks