Trying to add a HtmlLink to a master page from with in a user control. The below code is a simplify version on the final code missing out the database process. It also needs to be in a user control as it is used across multiple master pages.
The below code works in asp.net 2 but not in asp.net 4 coming up with the error.
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.'
Any help would be great.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim cssLink1 As New HtmlLink()
cssLink1.Href = "/ExternalFiles/CSS/V5.css"