ASP.NET error with Assembly

Hello I am creating an ASP.NET/C# website and I want to use the Ajax Toolkit assembly. I added it to the “References”.

In Default.aspx I have this:

<%@ Page Title="My_Website" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" ViewStateMode="Enabled" CodeBehind="Default.aspx.cs"
Inherits="My-Website._Default" %>

<%@ Register TagPrefix="ajaxToolkit" Namespace="AjaxControlToolkit" Assembly= "AjaxControlToolkit"%>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<ajaxToolkit:ComboBox ID="ComboBox1" runat="server" />
</asp:Content>

In the Design Tab I can see the Combo box and everything is fine.
But when I try to debug the application I get this error:

Could not find any resources appropriate for the specified culture or the neutral culture. Make sure “AjaxControlToolkit.Properties.Resources.NET4.resources” was correctly embedded or linked into assembly “AjaxControlToolkit” at compile time, or that all the satellite assemblies required are loadable and fully signed.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I had the same error message while ago and it was caused due to missing ScriptManager. Try to add ScriptManager to your aspx page.

<asp:ScriptManager runat="server"></asp:ScriptManager>

Or you can add ScriptManager dynamically at Page_Load event of code behind.

if (ScriptManager.GetCurrent(Page) == null)
{
     Page.Form.Controls.AddAt(0, new ScriptManager());
}

If you want to learn why we need ScriptManager when ASP.NET AJAX ToolKit is used you can check here.

Method 2

Where did you get the Ajax toolkit assembly? Wasn’t there any resource files with it (language resources etc.)? I have had this problem before when adding a reference to the assembly from a location where such resources were not present.

Upon removing, and adding from the originating location (where the resource files reside alongside) then the required files are also added to the references folder. All of these resources being added are a bit of a pain, actually (since they insist on expanding over an over!), if you’re not using them, but I haven’t found a way to ‘turn off’ this behaviour yet.

As a side note, you can place the following line within the <pages><controls> element of your web.config to enable access to the toolkit controls through the specified TagPrefix throughout your pages:

<add assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagPrefix="Ajax"/>

Method 3

You may need to add the ToolkitScriptManager and not the ScriptManager

  • You must use the ToolkitScriptManager instead of the ScriptManager with the Ajax Control Toolkit.

It’s written in the notes in the following link:

https://ajaxcontroltoolkit.codeplex.com/releases/view/116091

Method 4

Add to form:

<asp:ScriptManager ID="ScriptManager1" runat="server" />
or
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />

Method 5

Add a Script manager with UpdatePanel. The Problem will be solved


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x