Question

I added AjaxControlToolkit 4.0 to my project and added to Toolbox. Then I added Twitter control, just double clicked on it and didn't add anything else. But yellow page comes with:

  Server Error in '/' Application.
    The Controls collection cannot be modified because the control 
contains code blocks (i.e. <% ... %>). 

No page is mentioned in error. Do I need to add anything else to make it work? My code is like this:

 <asp:Twitter ID="Twitter1" runat="server"></asp:Twitter>

Thank you for your help.

Was it helpful?

Solution

I solved it. Appearently, we cannot use this control without ToolkitScriptManager. But this doesn't solve the error.

There was some if conditions in <% %> brackets in <head runat="server"> ... </head> section, I had to remove them. And added Page.Header.DataBind(); to the page_load to make it work.

This is how I added it to MasterPage. Hope it helps someone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top