why my ajax control doesn't work, even no error? - asp.net

i ahve tried what ever i can to put ajax calender extender in project but it doesn't show, calender never appears,
why ?
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScrptManager" runat="server"></asp:ScriptManager>
<asp:TextBox ID="txtBox" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" TargetControlID="txtBox" runat="server"></asp:CalendarExtender>
</div>
</form>
</body>
</html>
no error, 1st i download ajaxtoolkit for .net 4.5 then i added AJAX tab to tools then i right clicked AJAX tab and selected CHOOSE ITEMS and added these tools to project and then this code

You can replace the scriptManager in the page with
<Ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/> .
This will certainly solve your problem.

Related

JavaScript Error in Microsoft Edge with Telerik RadDatePicker in ASP.NET UpdatePanel

Telerik RadDatePicker inside ASP.NET UpdatePanel in Microsoft Edge browser throws JavaScript error when doing a post-back.
The error: "Unable to get property 'length' of undefined or null reference".
The RadDatePicker must be inside an UpdatePanel for the error to be thrown, and this ONLY happens in Microsoft Edge browser, all other browsers have no error.
Microsoft Edge version: 44.17763.1.0
Telerik Controls: Telerik.Web.UI, Version=2019.1.409.45
Any ideas how to fix this, or a work-around?
Here is my code:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EdgeDatePickerIssue.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Default</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server" ScriptMode="Release" />
<asp:UpdatePanel runat="server" ID="upPanel">
<ContentTemplate>
<label>Select Date:</label>
<telerik:RadDatePicker ID="dpStartDate" runat="server"
AutoPostBack="true"
OnSelectedDateChanged="dpStartDate_SelectedDateChanged" />
<telerik:RadButton ID="btnSave" runat="server"
Text="Save" OnClick="btnSave_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
Here is a screen-shot of the error:
Screen-shot Error in Edge
The problem is fixed in R2 2019.
Another way to solve it is setting the RadDatePicker's RenderMode property to Lightweight.
You could try to use Telerik RadScriptManager and Telerik RadAjaxPanel instead of using asp.net ScriptManager and UpdatePanel. Then, refer to this article to use DatePicker control.

AutoCompleteExtender Is not a known Element

Although, i write a code with all required lines in Asp.net , the Autocomplete extender not working ,i dont able to find the reason anyone can teach with code.
The Error i faced
Error 3 Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The system cannot find the file specified.
Error 4 Unknown server tag 'asp:ScriptManager'.
Error 4 Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site.
Error 5 Unknown server tag 'asp:AutoCompleteExtender'.
Error 5 Element 'AutoCompleteExtender' is not a known element. This can occur if there is a compilation error in the Web site.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>AJAX AutoComplete</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:TextBox ID="txtCity" runat="server"></asp:TextBox>
<asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtCity"
MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000"
ServiceMethod="GetCity" >
</asp:AutoCompleteExtender>
</div>
</form>
</body>
</html>
AjaxControlToolkit i installed . and i want to excecute autocomplete textbox code
I think you have register you ajaxtoolkit as ajaxtoolkit tag on page so instead of using tag you should use tag. For example.
<AjaxControlToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtCity"
MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000"
ServiceMethod="GetCity" >
Yes its workin now !! becoz of the auto generated bin folder in Vs .. and also i changed the ajax toolkit version 1.0.20229 For Visual studio 2005...Thank you so much for every one .. your replies helped me lot..

The ScriptManager must appear before any controls that need it

I have created a new ASP.NET Web Application, and after debugging i got Server Error
The control with ID 'WaitingPopup1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
I'm new with ASP.NET so where schould i install my ScriptManager, in the web.config?
The ScriptManager is a control that needs to be added to the page you have created.
Take a look at this Sample AJAX Application.
<body>
<form runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
...
</form>
</body>
If you are using microsoft ajax on your page you need the script manager control added to your master page or the page that needs it. It Manages ASP.NET Ajax script libraries and script files, partial-page rendering, and client proxy class generation for Web and application services
<asp:ScriptManager ID="ScriptManger1" runat="Server">
</asp:ScriptManager>
The full usage
<asp:ScriptManager
AllowCustomErrorsRedirect="True|False"
AsyncPostBackErrorMessage="string"
AsyncPostBackTimeout="integer"
AuthenticationService-Path="uri"
EnablePageMethods="True|False"
EnablePartialRendering="True|False"
EnableScriptGlobalization="True|False"
EnableScriptLocalization="True|False"
EnableTheming="True|False"
EnableViewState="True|False"
ID="string"
LoadScriptsBeforeUI="True|False"
OnAsyncPostBackError="AsyncPostBackError event handler"
OnDataBinding="DataBinding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnResolveScriptReference="ResolveScriptReference event handler"
OnUnload="Unload event handler"
ProfileService-LoadProperties="string"
ProfileService-Path="uri"
RoleService-LoadRoles="True|False"
RoleService-Path="uri"
runat="server"
ScriptMode="Auto|Inherit|Debug|Release"
ScriptPath="string"
SkinID="string"
SupportsPartialRendering="True|False"
Visible="True|False">
<AuthenticationService
Path="uri" />
<ProfileService
LoadProperties="string"
Path="uri" />
<RoleService
LoadRoles="True|False"
Path="uri" />
<Scripts>
<asp:ScriptReference
Assembly="string"
IgnoreScriptPath="True|False"
Name="string"
NotifyScriptLoaded="True|False"
Path="string"
ResourceUICultures="string"
ScriptMode="Auto|Debug|Inherit|Release" />
</Scripts>
<Services>
<asp:ServiceReference
InlineScript="True|False"
Path="string" />
</Services>
</asp:ScriptManager>
You can add your Script Manager tags just below the <Form> tag of your page. Here is how you can place your Script Manager tag.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
If you are using Master Pages, its recommended to use your Script Manager in your Master page so that you do not have to write it again and again on every page that contains AJAX controls.
Just put ScriptManager inside form tag like this:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
If it has Master Page then Put this in the Master Page itself.
The ScriptManager is a web control that you register in the page using
<asp:ScriptManager ID="ScriptManger1" runat="Server" />
inside the Form tag
There many cases where script Manager may give problem like that. you Try This First add Script Manager in appropriate Placeholder or any place Holder which appears before the content in which Ajax Control is used.
We need to add ScriptManager while using any AJAX Control not only update Panel.
<asp:ScriptManager ID="ScriptManger1" runat="Server" />
If you are using Latest Ajax Control Toolkit (I am not sure about version 4.0 or 4.5) you need to use that Particular ToolkitScriptManager and not ScriptManager from default Ajax Extensions.
You can use only one ScriptManager or ToolKitScriptManager on page, If you have added it on Master Page you no need to add it again on Web Page.
The problem mentioned here may because of ContentPlaceHolder Please Check how many content place holders you have on your master page. Lets take an example if you have 2 content Placeholders "Head" and "ContentPlaceHolder1" on Master Page and ContentPlaceHolder1 is your Content Page.please check below code I added here my ScriptManager on Second Placeholder just below there is update panel.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder id="MainContent" runat="server">
<asp:ScriptManager ID="ScriptManger1" runat="Server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Most of us make mistake while designing web form when we choose masterpage by default on web page there are equal number of placeholders as of MasterPage.
<%# Page Title="" Language="C#" MasterPageFile="~/Master Pages/Home.master" AutoEventWireup="true" CodeFile="frmCompanyLogin.aspx.cs" Inherits="Authentication_frmCompanyLogin" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
</asp:Content>
We no need to remove any PlaceHolder it is guiding structure but you must have to add the web form Contents in Same PlaceHolder where you added your ScriptManager(on Master Page) or add Script Manager in appropriate Placeholder or any place Holder which appears before the content in which Ajax Control is used.
It simply wants the ASP control on your ASPX page. I usually place mine right under the tag, or inside first Content area in the master's body (if your using a master page)
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="scriptManager" runat="server"></asp:ScriptManager>
<div>
[Content]
</div>
</form>
</body>
On the ASP.NET page, inside the form tags.
The script manager must be put onto the page before it is used. This would be directly on the page itself, or alternatively, if you are using them, on the Master Page.
The markup would be;
<asp:ScriptManager ID="ScriptManager1" runat="server" LoadScriptsBeforeUI="true"
EnablePartialRendering="true" />
with a head tag with runat="server"
inside a form tag with runat="server"
before the ContentPanels that contain controls that require it - typical controls with UpdatePanels:
<%=PageTitle%>
</form>
</body>
<asp:ScriptManager ID="scriptManager1" runat="server">
</asp:ScriptManager>
Add above code after tag.
It worked for me.

combobox items not displaying

This question has been asked here before, but the author wasn't very clear and got no answers (1st ref). Why aren't my combobox items displaying correctly? It is almost like they are there, but not connected to the combobox (notice my label, it shows up halfway down the page instead of right underneath the combobox when I run it). I get no errors on the page, which is good (different than when I tried doing this in VS2005), and the combobox displays fine, but when I click it, nothing is there.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:ComboBox ID="ComboBox1" runat="server" AutoPostBack="true"
DropDownStyle="DropDownList">
<asp:ListItem>thisis</asp:ListItem>
<asp:ListItem>mynetwork</asp:ListItem>
<asp:ListItem>getoffmyjunk</asp:ListItem>
<asp:ListItem>itsmine</asp:ListItem>
<asp:ListItem>illkillyou</asp:ListItem>
<asp:ListItem>forrealz</asp:ListItem>
<asp:ListItem>what</asp:ListItem>
<asp:ListItem>didyousaysomething</asp:ListItem>
<asp:ListItem>didn'tthinkso</asp:ListItem>
<asp:ListItem>meh</asp:ListItem>
</asp:ComboBox>
<br />
<asp:Label ID="lbl" runat="server">default text</asp:Label>
</div>
</form>
</body>
</html>
https://stackoverflow.com/questions/4322922/combo-box-items-does-not-display-below-of-combo-box-why
I'm having the same problem as this guy:
http://p2p.wrox.com/book-asp-net-ajax-programmers-reference-asp-net-2-0-asp-net-3-5-isbn-978-0-470-10998-4/80267-ajax-combobox-not-displaying-item-list-correctly.html
Your syntax looks to be incorrect for the ComboBox control. You want to use the Text and Value parameters in order to get the options to display. You'll want it to look like this:
<asp:ComboBox ID="ComboBox1" runat="server" AutoPostBack="true" DropDownStyle="DropDownList">
<asp:ListItem Text="thisis" Value="thisis"></asp:ListItem>
<asp:ListItem Text="mynetwork" Value="mynetwork"></asp:ListItem>
<asp:ListItem Text="getoffmyjunk" Value="getoffmyjunk"></asp:ListItem>
</asp:ComboBox>
Note: You may also be running into issues with your control tag declaration. For example, when I import the AJAX Control Toolkit into my applications, and add the proper references, I wind up using the tag "cc1" for all of the AJAX Control Toolkit controls. You may need to double check these references as well.
Use toolkitscriptmanager xDwanted to give the answer to Tim, but he won't put his comment as an answer ;;

ScriptManager required even though it is present

i am getting following error when i am running AJAX enabled ASP.Net application
The control with ID 'FilteredTextBoxExtender1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
even though i have ScriptManager in my page
what wrong i am doing please give suggestions
thanks in advance
<form id="form1" runat="server">
<asp:scriptmanager id="ScriptManager1" runat="server" />
<div>
<cc1:filteredtextboxextender id="FilteredTextBoxExtender1" targetcontrolid="textbox1"
filtertype="Numbers" runat="server"> </cc1:filteredtextboxextender>
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
</div>
</form>
What version of the toolkit? With recent versions at the time of writing, you need to use toolkitscriptmanager instead of the "normal" scriptmanager.
Place ScriptManager right before UpdatePanel

Resources