質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top