RSS 2.0
Sign In
# Tuesday, 03 May 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.

Page:

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

User control:

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

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

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, 03 May 2011 19:45:51 UTC  #    Comments [8] -
ASP.NET | Thinking aloud
Monday, 03 October 2011 16:04:11 UTC
Did you find a solution to this nuisance? Please share. Thanks
Jarick Rager
Monday, 03 October 2011 20:02:25 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, 24 January 2012 12:42:34 UTC
Hello,
I don't know what you've do exactly, I've recompile sources.
What have you fix in the code?
Derdour
Tuesday, 24 January 2012 14:48:48 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">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.NET4.Designer.cs</LastGenOutput>
<Link>AjaxControlToolkit\Properties\Resources.NET4.resx</Link>
<SubType>Designer</SubType>
</EmbeddedResource>
Wednesday, 25 January 2012 14:33:10 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">
<ContentTemplate>
</ContentTemplate>
</ajaxtk:TabPanel>
<ajaxtk:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel2" OnDemandMode="Once">
<ContentTemplate>
</ContentTemplate>
</ajaxtk:TabPanel>
</ajaxtk:TabContainer>
----------------------------

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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ajaxtk:ToolkitScriptManager ID="ScriptManager1" runat="server"></ajaxtk:ToolkitScriptManager>
<div>
<uc1:TabUC ID="TabUC1" runat="server" />
</div>
</form>
</body>
</html>
-----------------------------------


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
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configSections>
<sectionGroup name="system.web">
<section name="sanitizer" requirePermission="false"
type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, AjaxControlToolkit" />
</sectionGroup>
</configSections>

<appSettings/>
<connectionStrings/>
<system.web>
<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">
<providers>
<add name="AntiXssSanitizerProvider" type="AjaxControlToolkit.Sanitizer.AntiXssSanitizerProvider"></add>
</providers>
</sanitizer>

<!--
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">
</compilation>
<!--
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" />
</customErrors>
-->
<siteMap defaultProvider="SamplesSiteMap">
<providers>
<add name="SamplesSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Samples.sitemap"/>
<add name="WalkthroughsSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Walkthroughs.sitemap"/>
</providers>
</siteMap>
<globalization culture="en-us" uiCulture="en"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<!--
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.
-->
</configuration>
--------------------------

Thank's
derdour
Wednesday, 25 January 2012 14:52:24 UTC
Hello, derdour!

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

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, 25 January 2012 15:40:30 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.

derdour
Comments are closed.
Archive
<2024 December>
SunMonTueWedThuFriSat
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234
Statistics
Total Posts: 387
This Year: 3
This Month: 0
This Week: 0
Comments: 2176
Locations of visitors to this page
Disclaimer
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)