0

I am using Ajax dropdown extender on a button. But Getting a Runtime error

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

It Occuer when compiler try to compile extenderbase class. The code of eror in class is

  link.Attributes.Add("rel", "stylesheet");
                header.Controls.Add(link);

 //here i am getting the error            -->   // ASP.NET AJAX doesn't currently send a new head element down during an async postback,
                // so we do the same thing on the client by registering the appropriate script for after
                // the update.

What should I try to remove the Error.also I change the ajax toolkit version but that didn't work,I change <%=%> to<@#%> in master page but that als didn't work. I am using visual web developer 2010.

1 Answer 1

1

Try using the format <%#..... %> in your markup and then in your Page_Load method in codebehind put this line

Page.Header.DataBind();
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @abide I forget this in last script of master page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.