AJAX Toolkit installed not working VS2012 - asp.net

The majority of all other issues ive read about the AJAX Toolkit not working is related to some form of error that populates. I do not have an error I can reference! Which makes this bug a little harder to understand. I have a feeling I am missing ONE step. Ive gone through all the documentation and it shows that I am doing everything correctly.
The Issue:
I am trying to use a calendar extender on a textbox (which I have read that I no longer need to but that is aside the point). When I go to click on said textbox to make sure the toolkit is working, no calendar pops up!
The Double-Check: To check to see if it is the calendar itself (again, read that it was no longer needed) I added a confirm button extender to test the toolkit. It doesn't work either.
What have I done so far? I have: installed/reinstalled using NuGet the lastest version of the Ajax Control Toolkit (7.1213), commented out the registry in web.config and added to top of page (and visa versa), restarted VS2012 with every uninstall/reinstall, tried pulling syntax straight from the toolbox (which was taken from ajaxcontroltoolkit.dll) instead of hand-typing.
The Code:
web.config (added by NuGet on installation)
...
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.4" newVersion="2.1.0.4" />
</dependentAssembly>
</assemblyBinding>
</runtime>
...
page1.aspx
...
<%--patient ID panel--%>
<asp:Panel ID="pat_id_pnl" runat="server">
<div align="center">
<asp:Label runat="server" Text="SSN/MRN:" />
<asp:TextBox ID="ssn_mrn_txt" runat="server" style="margin-left:5px; margin-right:15px;"/>
<asp:Label runat="server" Text="Date of Appt:" />
<asp:TextBox ID="date_appt_txt" runat="server" style="margin-left:5px; margin-right:15px;"/>
<%--add calendar to date_appt_txt--%>
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="Server" />
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="date_appt_txt" Format="MM/dd/yyyy" />
<asp:Button ID="search_btn" runat="server" Text="Search" />
<%--Test confirm button extender--%>
<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="Are you sure you want to click this?" TargetControlID="search_btn"></ajaxToolkit:ConfirmButtonExtender>
</div>
</asp:Panel>
....
The line I was referring to earlier when I said "commented out the registry in web.config and added to top of page" I meant I commented this out of the web.config:
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
and added this to the top of the page before the first content place holder:
<%# Register tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" %>
Any help is greatly appreciated! Thanks.

So I figured a few things out after more searching.
To see an error with the ajax control toolkit, debug in internet explorer. Once I stopped debugging in chrome, I caught an error that said:
...AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts...
I had to remove Microsoft.Scriptmanager.MSAjax.dll from the bin folder of the project
That fixed my issue! Hope that it helps.

Related

User Controls not working in Visual Studio 2015

A user control that was working is no longer being picked up in the ASPX file.
ASPX File
<%# Register TagPrefix="Uc1" TagName="ContactForm" Src="~/Controls/VFEmailForm.ascx" %>
<uc1:VFEmailForm ID="VFEmailForm" runat="server" />
It was working but now isn't. A green line appears under the uc1:VFEmailForm and when you type Uc intellisense doesn't show Uc1. It is as though the register statement does not work - well it obviously doesn't. This was all working prior to upgrading to Visual Studio 2015.
I've shown part of my web.config file as ancient posts have suggested this may be the cause.
Web.config
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
<controls>
<add tagPrefix="webopt" assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" />
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
If there is a guru out there who can fix this I would appreciate it.
I had the same problem when building under x64. I switched to x86, rebuilt the project and VS 2015 worked as expected.
I was also in your situation a bit time ago.
1 .Try using the same tag name in both lines :
As in your case
<%# Register TagPrefix="uc1" TagName="ContactForm" Src="~/Controls/VFEmailForm.ascx" %>
<uc1:ContactForm ID="VFEmailForm" runat="server" />
If it helps then ok, otherwise after making this change , try restarting the visual studio.
This procedure helped me out.
I use Visual studio 2017, and faced a similar problem: Having green, wavy lines under the tagName instead the whole line, i.e., <Uc1:***ContactForm*** ...>. As part of this, I was getting this error:
Element ContactForm is not a known element.
A solution posted by #mitoutsnd on ASP.NET solved the problem by suggesting that I use:
Build > Rebuild Solution
This solved my problem.

IFrame with runat="server" not working while upgrading the website to .net4.5.1

We are upgrading our project from .Net2.0 to .net4.5.1.
The aspx page contains iframe tag as follows,
<iframe id="doc_preview" runat="server" src="" style="DISPLAY:inline; VISIBILITY:hidden"></iframe>
while building the project im getting the build error like "the type system.web.ui.htmlcontrols.htmliframe is not defined"
how can i resolve this?
Change the iframe to:
<asp:HtmlIframe id="doc_preview" runat="server" />
Rather than adding runat="server" to your iframe.
If it still throws issues then you'll want to add this to your web.config to make sure htmlcontrols are reference:
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.HtmlControls" assembly="System.Web"/>
</controls>

Asp controls not working on Chrome

I m facing a weird problem here, none of my asp controls is working in Chrome, i'm unable to access event the text box don' t know why this arises??
Can some one help me regarding this?
Directive:
<%# Page Language="VB" Debug="true" EnableViewState="true" CompilationMode="Always" AutoEventWireup="false" CodeFile="Enquiry.aspx.vb" Inherits="Enquiry" %>
This is my textbox coding:
<asp:TextBox ID="txtContactAddress" CssClass="TextArea" ToolTip="Enter Contact Address" runat="server" Width="380px" Height="75px" TextMode="MultiLine" ValidationGroup="Enquiry"></asp:TextBox>
I am using HTML 5 tags
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
I have included above doctypes..!!
The controls are working in IE 11 perfectly, i haven't tested it in anyother IE version, but it is not working in chrome, the control appears like an image in the chrome browser
I'm Using Visual-Studio-2013
Web.config:
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
</configuration>
EDIT:
I have got the answer..!! :) Hurray, but it is weird..! I was having the controls inside a section tag whose css had position:relative and z-index:600; I removed the position:relative and it is woking fine..! Dont know why the Position:relative disabled the Asp.net controls??
Any solutions are welcome..!!

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>

CollapsiblePanelExtender A potentially dangerous Request.Form value was detected from the client

I am encountering this error whenever the button is clicked to collapse/expand the panel.
Error: CollapsiblePanelExtender A potentially dangerous Request.Form value was detected from the client.
Can someone tell me what I did wrong and what is causing this?
<asp:Button ID="Button1" runat="server" Text="Button" />
<ajaxToolkit:CollapsiblePanelExtender
TargetControlID="testPanel"
ID="CollapsiblePanelExtender1"
runat="server"
ExpandControlid="Button1"
CollapseControlID="Button1"
Collapsed="False"
ExpandDirection="Vertical"
AutoCollapse="false"
AutoExpand="false">
</ajaxToolkit:CollapsiblePanelExtender>
<asp:Panel ID="testPanel" runat="server">
stuff here
</asp:Panel>
Put validateRequest="false" in your page directive or web.config file.
Adding Cross-Site Scripting Protection to ASP.NET
for example if you already have:
<%# Page Language="vb" AutoEventWireup="false" Codebehind="MyForm.aspx.vb" Inherits="Proj.MyForm"%>
then this should become:
<%# Page Language="vb" AutoEventWireup="false" Codebehind="MyForm.aspx.vb" Inherits="Proj.MyForm" ValidateRequest="false"%>
Note:
If you are using .NET 4 then you will need to add requestValidationMode="2.0" to the httpRuntime configuration section of the web.config file. For example:
<httpRuntime requestValidationMode="2.0"/>
If you don't already have a httpRuntime section in the web.config file then this goes inside the section.
Thanks

Resources