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.
HttpException
Resources.E_NoScriptManager
E_NoScriptManager
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:
ScriptManager.GetCurrent()
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.