none
Problems installing Ajax RRS feed

  • Question

  • I wanted to add some Ajax to a school project, so I went to this website to download NuGet as well as the latest AjaxControlToolKit. I ran this command in the Package Manager Console: 

    Install-Package AjaxControlToolkit

    and everything worked out fine. However, unless I want to register this toolkit at the top of every page, I need to put something into the web.config file. Currently I have this: 

        <compilation debug="true" targetFramework="4.0" >
          <assemblies>
            <add assembly="AjaxControlToolkit, Version=4.1.60501.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e'"/>
          </assemblies>        
        </compilation>

    however that gives me the following error: 

    Parser Error Message: Could not load file or assembly '"AjaxControlToolkit\, Version\=4.1.60501.0\, Culture\=neutral\, PublicKeyToken\=28f01b0e84b6d53e'"' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

    Any ideas? I think I may have the PublicKeyToken wrong, however I'm not sure. 

    Sunday, June 17, 2012 12:07 AM

Answers

All replies

  • If you're using NuGet, we can download the AjaxControlToolkit using its GUI. There is no need to use the command line.

    This said, to use the library in every page, without register it every time, you simply need this section if the web.config file:

    <pages>
      <controls>
        <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
      </controls>
    </pages>

    Note that, using NuGet, this section if automatically added.


    Marco Minerva [MCPD]
    Blog: http://blogs.ugidotnet.org/marcom
    Twitter: @marcominerva

    Sunday, June 17, 2012 10:58 AM
  • That's what I thought, however when I added the following control: 

    <asp:ToolkitScriptManager runat="Server" />

    It gave me this error:

    Parser Error Message: Unknown server tag 'asp:ToolkitScriptManager'.

    This is what the pages section of my web.config looks like (pretty much the same)

        <pages>
          <controls>
            <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
          </controls>
        </pages>



    Sunday, June 17, 2012 5:15 PM
  • In fact, the tagPrefix attribite of  Ajax Control Toolkit, as you can see in the web.config file, is ajaxToolkit, while you're using asp. So, the correct declaration is:

    <ajaxToolkit:ToolkitScriptManager runat="server" />


    Marco Minerva [MCPD]
    Blog: http://blogs.ugidotnet.org/marcom
    Twitter: @marcominerva

    • Marked as answer by NealRodruck Sunday, June 17, 2012 8:59 PM
    Sunday, June 17, 2012 5:18 PM
  • Thank worked, thank you! I'm wondering, then, do you (or anyone else) know what this page is referring to when half-way down the page they describe adding code like this: 

    http://ajaxcontroltoolkit.codeplex.com/

    <asp:ToolkitScriptManager runat="Server" />
    <asp:TextBox
            ID="txtComments"
            TextMode="MultiLine"
            Columns="60"
            Rows="8"
            runat="server" />
     
    <asp:HtmlEditorExtender
            TargetControlID="txtComments"
            runat="server" />

    Sunday, June 17, 2012 9:04 PM
  • The HtmlEditorExtender object transforms the TextBox in an Html Editor Control, like the one you can see here: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/HTMLEditorExtender/HTMLEditorExtender.aspx.


    Marco Minerva [MCPD]
    Blog: http://blogs.ugidotnet.org/marcom
    Twitter: @marcominerva

    Sunday, June 17, 2012 9:16 PM
  • Right, what I meant to say was this line of code: 

    <asp:HtmlEditorExtender
            TargetControlID="txtComments"
            runat="server" />

    Only works if I write it like this: 

    <ajaxToolkit:HtmlEditorExtender
            TargetControlID="txtComments"
            runat="server" />

    I'm wondering if this is an error in their instructions or if I missed something? 

    Sunday, June 17, 2012 9:19 PM
  • The tagPrefix can be a custom string, without any particular restrictions. The default is ajaxToolkit, as you have seen, but if you prefer, you can change it with any other values, simply changing the line in the web.config.

    So, probably in the HtmlEditorExtender example you refer, the tagPrefix has been set to asp.


    Marco Minerva [MCPD]
    Blog: http://blogs.ugidotnet.org/marcom
    Twitter: @marcominerva

    Sunday, June 17, 2012 9:24 PM
  • Good to know, thank you very much!
    Sunday, June 17, 2012 9:31 PM