You need to iterate over all the controls in ControlsCollectionand update the property of Hrefall the controls of the type HtmlAnchor, for example:
private void UpdateTags(Control page)
{
foreach (Control ctrl in page.Controls)
{
if (ctrl is HtmlAnchor)
{
((HtmlAnchor)ctrl).HRef = "myNewlink";
}
else
{
if (ctrl.Controls.Count > 0)
{
UpdateTags(ctrl);
}
}
}
}
source
share