Adding reference to AjaxControlToolkit to web.config file - web-config

I'm trying to add some ajax controls to my page:
<asp:Button runat="server" ID="lnkDelete" CommandName="DeleteCity" CssClass="rowbutton" CommandArgument='<%# Eval("cityid") %>' Text="Delete" />
<ajax:ConfirmButtonExtender runat="server" ID="confirm_Delete" TargetControlID="lnkDelete" ConfirmText="Deleting a city will delete all Suburbs, DICs and Appointments associated with it.
Do you want to continue?">
</ajax:ConfirmButtonExtender>
I've checked a couple of questions on SO and I found this as well, but still not having any luck getting pages to accept the new tag.
When I register the AjaxControlToolkit on Page level, it works, but when I add it to the web.config file, it still can't find the server tag:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>`) it works, but I'd rather not do this for every page that I need to use ajax on.
Note: Registering this way doesn't work if it is done on the master page.
I have the following in my web.config file:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<customErrors mode="Off" />
<pages styleSheetTheme="Default">
<controls>
<add tagPrefix="ajax" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
</configuration>
Have I done something wrong? What's the right way to do it here?
In case it might be important, I'm using AjaxControlToolkit version 4.1.51116

Turns out simply rebuilding the solution sorted this one out.
I persisted the change to add the reference into the web.config file and rebuilt the solution.
Everything works okay now

Related

Can I use existing WinUI3 controls in MAUI project?

Is it possible to use the exisiting controls of WinUI 3 in the MAUI project? Like controls in https://github.com/microsoft/WinUI-Gallery
I installed the WinUI package to my MAUI project
<ItemGroup>
<PackageReference Include="Microsoft.UI.Xaml" Version="2.7.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.1" />
</ItemGroup>
And edit the App.xaml
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiWithWinui"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
x:Class="MauiWithWinui.App">
<Application.Resources>
<controls:XamlControlsResources>
<controls:XamlControlsResources.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</controls:XamlControlsResources.MergedDictionaries>
</controls:XamlControlsResources>
</Application.Resources>
</Application>
as well as Platform/Windows/App.xaml
<maui:MauiWinUIApplication
x:Class="MauiWithWinui.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maui="using:Microsoft.Maui"
xmlns:local="using:MauiWithWinui.WinUI"
xmlns:controls="using:Microsoft.UI.Xaml.Controls">
<Application.Resources>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
</Application.Resources>
</maui:MauiWinUIApplication>
but when I went to use the WinUI control under a Page of MAUI, it prompted that the control could not be found
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
x:Class="MauiWithWinui.MainPage">
<Grid>
<controls:RatingControl AutomationProperties.Name="RatingControl with placeholder" PlaceholderValue="3" />
</Grid>
</ContentPage>
the MAUI project only targeted to windows platform, though i know winui3 project is a better choice
You are mixing frameworks. If you want to use a WinUI control, you are almost right except for the last step where you are adding the WinUI control into Maui XAML.
What you need to do is create a handler that sits between the maui page and the platform view: https://github.com/mattleibow/MauiWinUIRatingControlDemo
Th reason this is needed is that this code will also run on Android, so that needs to also do something. If you try build your code for Android now, it is impossible to even compile. MAUI sits in between and forms an abstraction that allows you do something else for each platform.
If you run my code on Windows with the handler, you get the rating control. If you run it on Android, you get a blank view as the Android handler is not yet created. You can then decide how you want to make this handler for Android or iOS and hook up events and properties accordingly.

The V2 feed at ‘…’ returned an unexpected status code '503 Service Unavailable'

I know there are similar questions, but none with this exact error, so I'm hoping there is a different answer.
I'm getting the error:
[feedname] The V2 feed at 'http://domain.tld/NuGetServer/nuget/Search()?$filter=IsLatestVersion&searchTerm=''&targetFramework='net46'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '503 Service Unavailable'.
I recieve this failure in the Package Manager UI in Visual Studio (2017 Professional), as well as the Console in VS. I have tried clearing the NuGet caches, TFS caches, checking (and modifying, as appropriate) proxy settings for NuGet (AppData\Local), proxy settings for TFS, Internet Options proxy settings, with apparently no change in results. I also tried accessing the feed in VS 2010, and it doesn't work there as well.
Why could this be happening? It seems like a proxy-related issue, but I've tried everything that other questions mention, and to no avail.
One clue might be the following: When I access the feed URL via a browser, I get the following back:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://domain.tld/NuGetServer/nuget/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Search</title>
<id>http://domain.tld/NuGetServer/nuget/Search</id>
<updated>2018-06-25T21:31:57Z</updated>
<author>
<name />
</author>
<link rel="self" title="Search" href="Search" />
</feed>
This is what I get when excluding the Search parameters:
<service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app" xml:base="http://domain.tld/NuGetServer/nuget/">
<workspace>
<atom:title>Default</atom:title>
<collection href="Packages">
<atom:title>Packages</atom:title>
</collection>
</workspace>
</service>
The NuGet server was configured incorrectly. I'm not exactly sure what the issue was, but once the server was re-configured to be have the default settings, and the URL in Visual Studio matched the server-configured URL, the issue was resolved.

AjaxControlToolkit 7.0123 breaks VS2012 Web Application Project

I have an existing VS2012 web application that has been running fine until I added in the latest AjaxControlToolkit (7.0123). Initially, I found that the installation broke the behaviour of the UpdatePanel - whereas before I could refresh a page after an asynchronous post-back without repeating the operation I found that after installation the refresh would repeat the previous operation (I guess the post-back was no longer asynchronous).
I then noticed that, at some time in the past, I had commented out a number of the default JavaScript files that are added to a new ASP.NET Web Forms Application so I tried adding them back in. This resulted in an exception:
'MsAjaxBundle' is not a valid script name. The name must end in
'.js'.
I then tried replacing the default <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> this resulted in a new exception
Could not load file or assembly 'System.Web' or one of its
dependencies. The system cannot find the file specified.
For sanity, I then created a fresh ASP.NET Web Forms Application (VS2012, Update 2) and ran it. No errors. Using "nuget", I then added the AjaxControlToolkit v7.0123 (the latest release). Ran the application again and I get the original exception again:
'MsAjaxBundle' is not a valid script name. The name must end in
'.js'.
Once again, I replaced <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> and once again this results in
Could not load file or assembly 'System.Web' or one of its
dependencies. The system cannot find the file specified.
Can anybody shed any light on what else I need to do to resolve this? I can find no documentation to say anything needs to be changed manually when adding the toolkit.
Thanks,
Answer found at http://stephenwalther.com/archive/2012/09/20/september-2012-release-of-the-ajax-control-toolkit.aspx (always just after posting the question huh)
Replacing <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> is correct
Need to remove reference to MsAjaxBundle
Need to remove Assembly="System.Web" from script references
This fixes the exceptions (both in the new project and the original).
It does not however resolve the problem with the UpdatePanel no longer posting back asynchronously. I will raise this as a new question.
If you are using the April 2013 Release of the Ajax Control Toolkit see Stephen Walther's latest blog post:
http://stephenwalther.com/archive/2013/04/30/april-2013-release-of-the-ajax-control-toolkit.aspx
I was missing the new web.config settings that allow the AjaxFileUpload control to work in the new release
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="42949672" />
<httpHandlers>
<add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295"/>
</requestFiltering>
</security>
</system.webServer>
</configuration>
When you see this "'MsAjaxBundle' is not a valid script name. The name must end in '.js'."
The Best thing you can do is:
Go to the site Master (Double click on it )
Search for "MsAjaxBundle" or " "
Comment this line eg. <%----%>
Save or compile your program and then run it
Thank God is working by now

CrystalReportViewer does not display Charts

My CrystalReportViewer won't display the charts in my Crystal Report. I get a red X.
I am using C# and MVC. I've read somewhere that I might need a virtual path to the image folder, but I am not really sure what that means as my chart is embedded in the report... Maybe I am missing something. Can anyone elaborate?
OK. I figured it out... MVC, like I said, is processing the route rather than letting the CrystalImageHandler handle it. So here are the steps to make MVC and Crystal ReportViewer display images work.
Read this link and follow the web.config instructions. Make sure all the assemblies point to version 12. You will actually need to install the Crystal Runtime and or Crystal to get the latest assembly versions.
Add this line to your global.asax file to ignore the route of the CrystalImageHandler:
routes.IgnoreRoute("{*allaspx}", new { allaspx = #".*(CrystalImageHandler).*" });
I had a similar problem with crystal reports imbedded with chart / graphs. Using MVC3 framework and crystal report runtime v10
Add the following lines to Web.config
<appSettings>
<!-- For Crystal reports to render dynamic images (eg. charts, graphs)-->
<add key="CrystalImageCleaner-AutoStart" value="true" />
<add key="CrystalImageCleaner-Sleep" value="60000" />
<add key="CrystalImageCleaner-Age" value="120000" />
</appSettings>
<system.web>
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>
</system.web>
Add this in the method RegisterRoutes in Globalasax
/*Added for Crystal reports*/
routes.IgnoreRoute("{*allaspx}", new { allaspx = #".*(CrystalImageHandler).*" });
Copy pg32conv.dll and sscsdk80.dll to Windows\System32.
i am also facing same problem while create my crystal report with chart(graphical representation ) , i am unable to get image of chart then
i add some code in web.config file
below the <appSettings></appSettings> tag
we have a tag like
<httpHandlers> </httpHandlers>
check we are having the code in between above taghttphandlers,
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
if it is there then we definetly get image of chart or bar what ever
if it is not there plz add the code like above k
i hope this is useful to all
thanks.

GWT module XML - how to redefine and use more than one user agent

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=FAQ_CompileOnePermutation
In the article I learned I can speed up the compiler but specifying the target user agent. The problem how can I specify more than one user agent? Suppose my application supports ie6 and FF3
<set-property name="user.agent" value="ie6,geck1_8" />
doesn't work - I got XML parsing error:
[ERROR] Invalid property value 'ie6,gecko1_8'
I'm wondering if there's a way to specify more than one specific user agent in the module XML file?
I've had a similar error message, when setting the user.agent value to gecko in GWT2.4. So I looked around and found where the gwt code defines the possible values.
If you look in the gwt-user.jar at com.google.gwt.user.UserAgent.gwt.xml you can see the possible values for the version of GWT you are using.
For GWT2.4, this is what i found:
<!-- Browser-sensitive code should use the 'user.agent' property -->
<define-property name="user.agent" values="ie6" />
<extend-property name="user.agent" values="ie8" />
<extend-property name="user.agent" values="gecko1_8" />
<extend-property name="user.agent" values="safari" />
<extend-property name="user.agent" values="opera" />
<extend-property name="user.agent" values="ie9" fallback-value="ie8" />
<property-provider name="user.agent" generator="com.google.gwt.user.rebind.UserAgentPropertyGenerator"/>
Therefore gecko is not a valid value for user.agent in my case, and if I use gecko1_8 it compiles for Firefox fine.
Works in GWT 1.6, your *.gwt.xml file :
<module rename-to="moduleName">
<!-- blah blah -->
<set-property name="user.agent" value="ie6,gecko,gecko1_8" />
<!-- generate perms for IE and firefox only -->
</module>
for webkit based browsers like chrome, use "safari" as the user agent
In order to rapidly deploy any application, you'll need two targets; once for the engine your hosted mode deploys on {Firefox / Linux, Safari / Mac, IE6 / Win}, and one for your agile browser that lets you build css in real-time {Firefox + Firebug}.
Linux: <set-property name="user.agent" value="gecko1_8,gecko"/>
Mac: <set-property name="user.agent" value="gecko1_8,safari"/>
...etc...
This is GWT >= 1.6 ONLY!
For older gwt projects, you must super-source the com/google/gwt/user/UserAgent.gwt.xml file... Put it in a source location that is included BEFORE your gwt-*.jar on the classpath. Basically, you can copy that file into a new one in the same package as the original, and edit the CDATA javascript block that returns the actual user.agent value. Play with this all you like, but don't go getting too crazy with their user.agent property, as it WILL be changing for ie8 in a future build.
To target ie browsers, make up your own ie.version property, and tweak a copy of the property-provider in UserAgent.gwt.xml to target different versions of ie. Just make sure that when you use the custom property for deferred binding you do:
<all>
<when-property-is name="user.agent" value="ie6"/>
<any>
<when-property-is name="ie.version" value="ie7"/>
<when-property-is name="ie.version" value="ie8"/>
</any>
</all>
Or you'll get ie7 + gecko/safari builds and other silly junk that will never be used.
Note: Any code in a property-provider is loaded in the .nocache.js, and can be useful to preload images / css whilst the .cache.js payload is being downloaded.
Just add var __cached = new Image('Url To Compiled Image / Whatever you want to load');
Not yet. The idea is that you develop rapidly to one browser and then compile once to deploy (i.e., do final testing) for all browsers, with GWT handling the browser differences. Don't forget that at deploy time GWT will optimize the downloads per browser so that in the end it doesn't matter how many user agents you chose.