C# – ASP.NET error with Assembly

asp.netassembliesc

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.

Best Answer

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.

Related Topic