I have a bit of a weird problem I can't seem to fix. I am using the AJAX Control Toolkit's calendar extender on some of my pages. Despite the information I've found via the web I can't seem to get it working with a regular ScriptManager control, it only works with a ToolkitScriptManager. However I've noticed that when the page loads it adds some 84 script files for every possible control script provided by the toolkit:
Is this the expected behaviour, and can I turn it off? I only need it to load the relevant scripts to handle the calendar extender.
In current version of ACT you can group extenders in bundle and specify which bundles you need to include.
Add AjaxControlToolkit.config file to project like here Codeplex AjaxControlToolkit.config, add new controlBundle entry to this file for CalendarExtender like this:
<controlBundle name="Calendar">
<control name="CalendarExtender"></control>
</controlBundle>
and specify this bundle in ToolkitScriptmanager control:
<ajaxToolkit:ToolkitScriptManager runat="server" CombineScripts="true"
ScriptMode="Release" >
<ControlBundles>
<ajaxToolkit:ControlBundle Name="Calendar" />
</ControlBundles>
</ajaxToolkit:ToolkitScriptManager>
Use ControlBundles to solve this, follow this step about ControlBundles on how to do it.
Related
I'm trying to implement the HtmlEditorExtender from AJAX Control Toolkit.
Is it possible to change the control language? I'd want the language to be French. I have no problem at all changing the language of the CalendarExtender control, but it doesn't work at all with the HtmlEditorExtender. For example, the control still display English words like "Font" and "Size".
I have done everything that is suggested on the web to change the language.
The globalization culture is set in the web.config:
globalization uiCulture="fr" culture="fr-CA" fileEncoding="utf-8"
I have a script manager in the master page and the EnableScriptGlobalization and EnableScriptLocalization are both set to true:
asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true"
EnableScriptLocalization="true" ScriptMode="Release" AsyncPostBackTimeOut="0"/>
The culture is set on the page:
%# Page Language="C#" MasterPageFile="~/FullForm.master" AutoEventWireup="true" Culture="fr-CA" UICulture="fr"
Inherits="LAC.WebApp.Management.Parameters.ParametersPage" meta:resourcekey="Page" CodeBehind="Parameters.aspx.cs" %
I have a "fr" folder in the bin folder with the AjaxControlToolkit.resources.dll file in it.
I tried to run the application in release mode but it didn't change anything at all.
If you have any idea, please share it!
Thank you
HtmlEditorExtender is not localized. These strings are hardcoded.
So, the only option at the moment is to change it in source code and make a custom build.
When using ASP.NET AJAX, you can point to an external CDN when declaring the script manager
for example
<asp:scriptmanager runat="server" enablecdn="true"></asp:scriptmanager>
However, I have noticed that if there is a user control on the same page which uses a custom validation, the framework still generates this code
/ScriptResource.axd?d=9yV7lSty3eIjRHuyQO6mUIbifRXho5yOz18Mb9LNzPDMVDZt5gucvycOn0YjgTb-p_rRW2V1ZDDrrpuaOC7nExHrA_4WmsL5gsOQ0m2syuuMp2VfpWep-II1V1zy1jHYfkvYfBRkGo_2LqqJh0Gung2&t=fffffffff11c85e0
which points to a local resource. I want this to point to the same CDN instead
Any ideas how to fix this?
I figured out how to fix/resolve this if it is of any help.
Basically I needed to disable 'AjaxFrameworkMode' property of the ScriptManager as shown below
<asp:ScriptManager ID="ScriptManager1" EnableCdn="true" runat="server" AjaxFrameworkMode="Disabled"> </asp:ScriptManager>
The AjaxFrameworkMode property adds two new modes to ScriptManager’s
behavior. Enabled (the default, and the same behavior as before),
Explicit (does not include any scripts by default but still assumes
Microsoft Ajax is to be utilized), and Disabled (does not include any
scripts by default and does not assume Microsoft Ajax will be used). For more details read more...
There are quite a few questions out there regarding this (for me, recurring) issue, but none of them have solved my problem.
Problem:
Whatever control I add in my aspx page, it is not recognised in the codebehind. Compiling doesn't work, because the ID is not recognised.
None of the following worked:
Clean and rebuild solution.
Close and open VS
Delete asp.net temp files
Check project's target framework.
Check assemblies are all there.
Check designer viewn to see if the control is actually there (it is)
Get control's ID with JS function to check it is the intended one (it is)
The problem has started only recently. In fact, I can reference the older controls fine.
The problem is observed both with standard ASP controls and Telerik ones.
Does anyone know of something else I should try? Please help me, I'm in the middle of a project and this is causing unnecessary delays, ta.
Make sure all of your asp.net controls (in the .aspx file) have the:
runat='server'
tag... Without this, you will not be able to reference the controls.
e.g.
<asp:Label runat='server' Text='Test Label' ID='TestLabel' />
Hope this helped...
Rodit
This is how I solved my issue. For a full account of it, please refer to the comments above.
I've noticed that although my project was already of web application type, designer files weren't showing.
I've forced the designer files to be recompiled by clicking on the ''convert to web application' option
I was then able to reference the control ID.
Thanks to the commentators anyway.
I was having a similar issue, due to the fact that I was using the pre-generated Login page. My solution was to change this section from this:
<asp:Login runat="server" ViewStateMode="Disabled" RenderOuterTable="false">
<LayoutTemplate>
To this:
<asp:Login ID="asplogin" runat="server" ViewStateMode="Disabled" RenderOuterTable="false">
<LayoutTemplate>
basically, I just added an ID to the asp:Login which allowed me to access the objects in the code from behind by prefixing the control name with asplogin
asplogin.youControlNameHere
I'm working with masterpages and after reading a lot of answers I can't find why my calendarextender doesn't appear
Here is my code
http://pastebin.com/m789f935e
did you check the setting in the webconfig file . do you have all the required settings for ajax . ?
Have you tried changing the TagPrefix in the
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
directive to something other than asp? Not sure how well referencing more than one assembly for a single TagPrefix is supported.
The info here and here sort of backs me up...sort of. Give it a shot and let us know how it goes.
I see you have more than one ScriptManager tag... one in the Master page and one in your VerFavoritos.aspx page. I suggest you add one ScriptManager in the Master, place it right after the tag and before anything else in the Master page. Remove any ScriptManager tags from the VerFavoritos.aspx page.
Hope this helps.
Do you have the AJAX Control Toolkit .dll in your References?
The entry in the web.config you are looking for is something along this line:
<add assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagPrefix="AjaxControlToolkit"/>
When this happens you can use the calendar extender with syntax like:
<AjaxControlToolkit:CalendarExtender ... />
Rebor.
My application have a page that displays a ModalPopUp (the modal pop up pf ajax toolkit).
Inside the PopUp i put a calendarExtender, but the calendar appears behind the PopUp, so, to solve it i need to associate my Calendar to a CSS, like this:
<cc1:CalendarExtender ID="txtProximoContato_CalendarExtender" runat="server" PopupButtonID="imgCalendarProxContato"
Enabled="True" CssClass="CalendarPopup" TargetControlID="txtProximoContato">
</cc1:CalendarExtender>
and the CSS class
.CalendarPopup
{
z-index: 10500 !important;
}
I dont know if it is your problem, but i hope this help you
To be honest the Ajax Control Toolkit has been superceded by things like jQuery. Seriously consider using jQuery UI or extjs instead - I've always found this library to buggy and badly supported.
I copied/pasted your code almost exactly as it was and the calendar extender appeared.
Follow these steps exactly and it should work for you
Uninstall and reinstall AJAX 1.0.
From within VS 2005, create an "AJAX Enabled Website" instead of a regular website (VS 2008 automatically creates this type of website).
Add a reference to AjaxControlToolkit and it should work.
If you are still having trouble
Send me your solution. I'll correct it and send it back to you.
I've followed all the steps to get intellisense working for jQuery in VS 2008 SP1 (with the vsdoc hotfix). It works when I reference jQuery inside an asp:ScriptManager control like so:
<asp:ScriptManager runat="server">
<scripts>
...
</scripts>
</asp:ScriptManager>
But I'm using ajax ToolkitScriptManager instead and the intellisense doesn't seem to work when using this control. It offers some better features so I'm not willing to live without it.
It looks like the VS team only programmed the jQuery intellisense to look for asp ScriptManager controls and not ToolkitScriptManager. Has anyone found a workaround for this specific problem?
Cheers
Wows, I, had the same problem and used the following method to trick Visual Studio:
<% if(false) { %>
<script src="/scripts/jquery-1.3.2.js" type="text/javascript"></script>
<% } %>
The script tag will never be rendered but VS interprets it and enables intellisense.
If the file is contained in your project with a -vsdoc.js at the end, IntelliSense should work. Rick Strahl has a great post about this at http://www.west-wind.com/Weblog/posts/536756.aspx
A different question: why are you putting the JQuery library in the script manager?
The script manager can do some cool things, like compress the javascript files for you -- but that only works if the JavaScript is in a resource file.
Also, using the ScriptManager adds a bunch of extra JavaScript that will not be downloaded by the client (all of the Microsoft AJAX libraries). Which is fine so long as you are using the Microsoft AJAX Toolkit, but is a lot of extra load if you are not.
EDIT: if you want a better relative position get JQuery from Google Code. You can read about it here: http://code.google.com/apis/ajaxlibs/