Question : The Controls collection cannot be modified because the control contains code blocks in masterpages

Hi, I am trying to dymanically create the metatags for the title, description and keywords. This is being done in the vb script in a page that has its own master page. I have looked at other similar issues and it seams to imply that this error is because there is some java script in the header section and this should be moved to the page load section, which I cannot see how to do.
My master page header looks like this:

<head id="Head1" runat="server">
        <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
       <script type="text/javascript">
        function RefreshPage() {
            var pgeId = '<%= Page.ClientID %>';
            _dopastBack(pageId, 'Myargs');
        }
        function showall() {
            var sPath = window.location.pathname;
            var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
            window.location.href = sPage;
        }
</script>

I then have a child page:
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

and in the onpage load in the VB script for the page have:
Dim HeadTitle As New HtmlMeta
        HeadTitle.Name = "Title"
        HeadTitle.Content = "This page is about - " + myTable(0)("Description")
        Header.Controls.Add(HeadTitle)

But I get the error message:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
on the line:
Header.Controls.Add(HeadTitle)
any suggestions to work arround this ?

Answer : The Controls collection cannot be modified because the control contains code blocks in masterpages

OpenSpirit is the best tool to go.

We as an Energy Company use it for data exchange between our databases.

You will need to have your own Module AND/OR  STD and DB structure before you can use it

Here is what they are saying about their tool:

Data management workflows accelerate finding, viewing and sharing of data among data stores and applications, whether from your desktop, E&P portal environments, or both.

With OpenSpirit, end users can view data concurrently from multiple sources using common viewing tools, while ensuring proper conversion of units and geographic coordinate transformations

For more info, this is their website

http://www.openspirit.com/index

Good luck
Random Solutions  
 
programming4us programming4us