RSS 2.0
Sign In
# Tuesday, May 3, 2011

Already for a couple of days we're trying to create a UserControl containing a TabContainer. To achieve the goal we have created a page with a ToolkitScriptManager and a user control itself.


<form runat="server">
  <ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/>
  <uc1:WebUserControl1 ID="WebUserControl11" runat="server" />

User control:

<%@ Control Language="C#" %>
<%@ Register
  TagPrefix="ajax" %>

<ajax:TabContainer ID="Tab" runat="server" Width="100%">
  <ajax:TabPanel runat="server" HeaderText="Tab1" ID="Tab1">
    <ContentTemplate>Panel 1</ContentTemplate>

What could be more simple?

But no, there is a problem. At run-time control works perfectly, but at the designer it shows an error instead of a normal design view:

Error Rendering Control - TabContainer1
An unhandled exception has occurred.
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.

That's a stupid error, which says nothing about the real problem reason. We had to attach a debugger to a Visual Studio just to realize what the problem is.

So, the error occurs at the following code of AjaxControlToolkit.ScriptControlBase:

private void EnsureScriptManager()
  if (this._scriptManager == null)
    this._scriptManager = ScriptManager.GetCurrent(this.Page);

    if (this._scriptManager == null)
      throw new HttpException(Resources.E_NoScriptManager);

Originally, the problem is due to the fact that ScriptManager is not found, and code wants to report an HttpException, but fun is that we recieve a different exception, which is releted to a missing resouce text for a message Resources.E_NoScriptManager. It turns out that E_NoScriptManager text is found neither in primary no in resource assemblies.

As for original problem, it's hard to say about reason of why ScriptManager is not available at design time. We, however, observed that a ScriptManager registers itself for a ScriptManager.GetCurrent() method at run-time only:

protected internal override void OnInit(EventArgs e)
  if (!base.DesignMode)
    iPage.Items[typeof(ScriptManager)] = this;

So, it's not clear what they (toolkit's developers) expected to get at design time.

These observations leave uneasiness regarding the quality of the library.

Tuesday, May 3, 2011 7:45:51 PM UTC  #    Comments [8] -
ASP.NET | Thinking aloud
Monday, October 3, 2011 4:04:11 PM UTC
Did you find a solution to this nuisance? Please share. Thanks
Jarick Rager
Monday, October 3, 2011 8:02:25 PM UTC
Yes. We have found.
We had to fix AJAXToolkit project file and recompile sources,
so resources are included in assembly.

We're not satisfied with such solution.
Vladimir Nesterovsky
Tuesday, January 24, 2012 12:42:34 PM UTC
I don't know what you've do exactly, I've recompile sources.
What have you fix in the code?
Tuesday, January 24, 2012 2:48:48 PM UTC
Please open AjaxControlToolkit.csproj in text editor (e.g. notepad) and verify you have text like this there:

<EmbeddedResource Include="Properties\Resources.NET4.resx">
Wednesday, January 25, 2012 2:33:10 PM UTC
Thanks Vladimir for the replay.
I've make the changes, an now, I've an other error:
Error Rendering Control - TabContainer1
ScriptManager is required on the page to use ASP.NET AJAX Script Components

I'm using the latest source codes of AjaxToolKit with VS 2010 (november 16th 2011).
for tests, I use a very simple example with one User Control with TabContainer, and a webform containing the user control. The tests are directly implemented in the AjaxControlToolkitSampleSite, Tabs directory. I've done an other test in an new WebApplication project, the error is same.
However, I've not the error if I put the TabContainer directly in the webform,

This is the user control code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TabUC.ascx.cs" Inherits="Tabs_TabUC" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtk" %>
<ajaxtk:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="128px" Width="332px" OnDemand="true">
<ajaxtk:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1" OnDemandMode="Once">
<ajaxtk:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel2" OnDemandMode="Once">

this is the web form :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TabsWebForm1.aspx.cs" Inherits="Tabs_TabsWebForm1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtk" %>
<%@ Register src="TabUC.ascx" tagname="TabUC" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
<form id="form1" runat="server">
<ajaxtk:ToolkitScriptManager ID="ScriptManager1" runat="server"></ajaxtk:ToolkitScriptManager>
<uc1:TabUC ID="TabUC1" runat="server" />

this is the web.config of the sample project:
<?xml version="1.0"?>
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
<sectionGroup name="system.web">
<section name="sanitizer" requirePermission="false"
type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, AjaxControlToolkit" />

<trust level="Full" />
The AntiXSS Library requires Full Trust. We don't recommend using the
HtmlEditorExtender for a public website without running the website in
Full Trust. If you do not plan to use the HtmlEditorExtender then you
can remove the following sanitizer section.

<sanitizer defaultProvider="AntiXssSanitizerProvider">
<add name="AntiXssSanitizerProvider" type="AjaxControlToolkit.Sanitizer.AntiXssSanitizerProvider"></add>

Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
<compilation debug="true" targetFramework="4.0">
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
<authentication mode="Windows"/>
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
<siteMap defaultProvider="SamplesSiteMap">
<add name="SamplesSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Samples.sitemap"/>
<add name="WalkthroughsSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Walkthroughs.sitemap"/>
<globalization culture="en-us" uiCulture="en"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.

Wednesday, January 25, 2012 2:52:24 PM UTC
Hello, derdour!

You probably need a script manager proxy on your control.
Please see ScriptManagerProxy .
Wednesday, January 25, 2012 3:03:39 PM UTC

besides of the problem itself...
if it's not too late in your development cycle then you better switch to jquery and use RESTful services (no matter, either with ASP.NET or WCF).

The code will be cleaner and faster.
Wednesday, January 25, 2012 3:40:30 PM UTC
Thanks lot Vladimir,

I've used TabContainer to replace Infragistics UltraWebTab wich causes a problem in extranet of our client (we are not allowed to intervene in there installation).
The problem is resolved by using AJAXControlToolKit TabContainer instead. All work fine (build, debug, deployement), the only problem I have is at VS Design mode, like the error mentiened in your post and only when using TabContainer in a UserControl!

For RESTful, I don't know this compopent, I'll see that an other time.

Comments are closed.
<May 2011>
Total Posts: 387
This Year: 3
This Month: 0
This Week: 0
Comments: 1370
Locations of visitors to this page
The opinions expressed herein are our own personal opinions and do not represent our employer's view in anyway.

© 2024, Nesterovsky bros
All Content © 2024, Nesterovsky bros
DasBlog theme 'Business' created by Christoph De Baene (delarou)