ajaxtool kit - Html editor tools not displayed - asp.net

I have installed ajaxtoolkit version 4.5 and included below lines in the config under controls tag
<add tagPrefix="ajaxtoolkit"
namespace="AjaxControlToolkit"
assembly="AjaxControlToolKit"/>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc1" %>
<ajaxtoolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxtoolkit:ToolkitScriptManager>
<cc1:Editor ID="Editor1" runat="server" Width="300" Height="400"/>
if i use html editor control getting the below error in IE9
0x800a139e - Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.
and in chrome the editor is displayed with no tools in it.
Please help to resolve this

Please change your code like this:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager>
HTML Markup:
<cc1:Editor ID="Editor1" runat="server" Width="300" Height="400"/>
You can save your HTMLEditor content in database like this:
string lsPageContent = Server.HtmlEncode(Editor1.Content);
Insert into [TableName] (PageContent) Values ('" + lsPageContent + "');
and fetch page content like this:
Editor1.Content = Server.HtmlDecode(YourcolumnValue);

Related

AjaxFileUpload Doesn't Display Correctly or Function: Mysterious Black Button

I found AjaxFileUpload in the toolkit when searching for ways to upload multiple files.
I used NuGet to install.
Added <%# Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%> to the top of the page.
Ensured web.config has the reference:
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
Where I presume the the upload button should be, I get a black box, when I run the page. The preview does show up correctly.
I did try it in a completely empty page (no master page or anything) and I get the same result.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="School_Scheduler_2.Associates.test" %>
<%# Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajaxToolkit:AjaxFileUpload runAt="server" ID="multiUpload" />
</form>
</body>
</html>
Any suggestions?
Answer Since My Account Is Too Noob to the Post Answer Myself
This explains it: https://ajaxcontroltoolkit.codeplex.com/workitem/27493
Long story short: The Ajax Tool Kit does not like the vanilla ScriptManager. It insists on using their own ToolkitScriptManager.
This causes havoc with my MasterPages (I put the script manager on there to save me from adding it everywhere), but at least I know now and can start scheming possible solutions.
try this
<asp:ToolkitScriptManager ID="ScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<div align="center">
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" AllowedFileTypes="jpg,jpeg,png,gif"
MaximumNumberOfFiles="10" OnUploadComplete="File_Upload"
Width="500px" />
Old question, but make sure to debug any javascript errors. Any errors will cause the described black button.
If you have any client side code that runs on OnClientUploadCompleteAll=, but fail to copy this code to a new page if you are copy/pasting the AjaxFileUpload control, you get a javascript error and it fails to render the control at this point, just leaving you with the black button.

How can I add namespaces to my asp.net page?

I've just added Ajax Control Toolkit with NuGet, and I want to add the following piechart:
<ajaxToolkit:PieChart ID="pieChart1" runat="server" ChartHeight="300"
ChartWidth="450" ChartTitle="Widget Production in the world"
ChartTitleColor="#0E426C">
<PieChartValues>
<ajaxToolkit:PieChartValue Category="United States" Data="45"
PieChartValueColor="#6C1E83" PieChartValueStrokeColor="black" />
<ajaxToolkit:PieChartValue Category="Europe" Data="25"
PieChartValueColor="#D08AD9" PieChartValueStrokeColor="black" />
<ajaxToolkit:PieChartValue Category="Asia" Data="17"
PieChartValueColor="#6586A7" PieChartValueStrokeColor="black" />
<ajaxToolkit:PieChartValue Category="Australia" Data="13"
PieChartValueColor="#0E426C" PieChartValueStrokeColor="black" />
</PieChartValues>
</ajaxToolkit:PieChart>
However, my page has no clue what PieChart is, how can I add ajaxToolkit and link it to the dll file in the aspx page?
Mine looks like this:
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
If you drop an ajax control onto the form, it should create the registration for you. Mine above is an auto generated reference to the ajax toolkit. You also have to add a reference to the Ajax dll through the project references (although Nuget might have done this already, not sure).
I hope the following images will be useful. And download the needed AJAX .dll file.
Add this:
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
Step 1:
Step 2:
Step 3:
Step 4:

TextBoxWatermarkExtender

i am new to asp.net and i was to work in AjaxControlToolkit and i instaled and performed other operation but it is showing me report...,
error is:
The type name 'TextBoxWatermarkExtender' does not exist in the type 'AjaxControlToolkit'
protected global::AjaxControlToolkit.TextBoxWatermarkExtender TextBoxWatermarkExtender1;
code is:
<asp:TextBoxWatermarkExtender id="TBWEDOB" runat="server" targetcontrolid="txtDOB"
watermarktext="dd/mm/yy" watermarkcssclass="watermarked"> </asp:TextBoxWatermarkExtender>
plz any one pelp me on this flow....,
First Check This
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
in Your Page and see what is the TagPrefix in your page and than use that.like
<asp:TextBoxWatermarkExtender ID="TBWE2" runat="server"
TargetControlID="TextBox1"
WatermarkText="Type First Name Here"
WatermarkCssClass="watermarked" />
it will work defiantly
Why don't you simply try placeholder property to achieve the watermark in input fields.
Yes, There is a restriction of older browser, so if you are working with newer version (suppots HTML 5) then you can use it like this
<asp:TextBox ID="textbox1" runat="server" placeholder="dd/mm/yyyy"></asp:TextBox>
You haven't provided much information so it will be tough to identify where your mistake is, here's a simple step-by-step list of how you can use AJAX in your application, just follow the points below and it will work:
1) Download AJAX from codeplex, save and unzip anywhere on your machine
2) In Visual Studio Toolbox, Right click-> Add Tab, give it a name
3) Right click the newly created tab -> Choose Items...
4) Click Browse, find AjaxControlToolkit.dll and click OK
5) If all is well the controls will be added to your toolbox
6) Drag and drop a ToolkitScriptManager to the .aspx page, doing this will automatically:
6.1) Add a AjaxControlToolkit.dll reference to your project
6.2) Add the following line to the source view of your page
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
7)Drag and drop a TextBoxWatermarkExtender to the .aspx page and you're done:
<asp:ToolkitScriptManager ID="sm" runat="server" />
<asp:TextBoxWatermarkExtender ID="watermark" runat="server" TargetControlID="txtName" WatermarkText="Type name here..." />
<asp:TextBox ID="txtName" runat="server" />
try modifying the tag prefix
on the top of the page register the ajax tool kit.
<%# Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" TagPrefix="ajax" %>
<ajax:TextBoxWatermarkExtender id="TBWEDOB" runat="server" targetcontrolid="txtDOB"
watermarktext="dd/mm/yy" watermarkcssclass="watermarked"> </ajax:TextBoxWatermarkExtender>

ToolkitScriptManager is not a known element

I have a website in which I am using the AJAX Accordion Pane. In order to fully use the RequireOpenedPane="False" I need to have the ToolkitScriptManager added to the site.
I understand all of this but there's an issue. Visual Studio 2012 says the ToolkitScriptManager is not a known element
I have
<add tagPrefix="asp" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
in the web.config file, and
<asp:Accordion ID="Accordion1" runat="server" CssClass="accordion" SelectedIndex="-1" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent" RequireOpenedPane="False" FramesPerSecond="25" Width="820px" >
works with no errors. But
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
does not.
Here's the funny thing, if I remove the ToolkitScriptManager from the page, it'll load the Accordion, however, not all functionality will be working (for example, clicking an accordion header does not select the header, it just expands the header, but does not show as "Selected").
The page DOES have a MasterPage as well, the ToolkitScriptManager is inside the ContentPlaceHolder for the body. (it's actually right above the Accordion control). Why is this doing this, and how can I fix it?
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="page.aspx.cs" Inherits="page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MenuContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<h1 align="center">Classes</h1>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
<asp:Accordion ID="Accordion1" runat="server" CssClass="accordion" SelectedIndex="-1" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent" RequireOpenedPane="False" FramesPerSecond="25" Width="820px" >
<Panes>
<asp:AccordionPane runat="server" ID="AccordionPane0">`
Found solution:
Apparently the AjaxControlToolkit obtained from using the NuGet installer on Visual Studio 2010 does NOT have the ToolkitScriptManager. I had to remove the DLL installed from NuGet and install my own DLL which did include the ToolkitScriptManager.
I'm not sure why the NuGet version does not contain the ToolkitScriptManager.
On top of your solution user1760784, others may ALSO need to setup IIS first and import their app in. Once the app is fully setup in IIS then try to run it. It should work. With this process done my issue was resolved.
Please note this is true for both test IIS and live/production IIS. Although as we all know it's always safer to test off live boxes.
Why does it only resolve when testing on IIS?
I don't really know. However I believe it could because of http/browser issues. Maybe you smarter folks can let us know on this point.
Enjoy!

ASP Ajax control toolkit calender extender not displayed properly

ASP Ajax control toolkit Calender extender is not appearing properly. Only text values are appearing and looks like CSS is not applied. I tried to disable all the CSS definitions for the page but still it is not being displayed properly.
<%# Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeBehind="DataDownload.aspx.cs" Inherits="myapp.DataDownload" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="head_content" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="body_content" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:TextBox ID="txtFromDate" CssClass="inp-form" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="calFromDate" runat="server" TargetControlID="txtFromDate" >
</asp:CalendarExtender>
</asp:Content>
Try commenting Existing Js files on page.
reason : simple, As we know ajax on [page load complete] method makes javascript Code on the fly , which conflicts with existing javascript/jquery on the page, which results on malfunction of either functionality.

Resources