I need to add an autocomplete extender to my list page. I have gotten this to work in the past but it uses ToolKitScriptManager instead of ScriptManager. Because the markup generated by the datascaffolding already has a Scriptmanger in the site.master
page. I can't add another ToolKitScriptManager on the same page. So I changed the ScriptManger markup to ToolKitScriptManger . But I get the error 'jquery' is not a valid script must end in js. The code in the site.master follows.
As your error is clearly saying that you need to add .js with
ScriptReference. Below is your code which is wrong... You need to pass Name which has
.js extension.
<asp:ScriptReference Name="jquery" />
Like same line below this you have mentioned the name with .js extention.
Unable to get property of UI of undefined or null reference
This is on my autoextender. I looked all over the internet and they say to change scriptmanager to toolkitscriptmanager. That's when I get the previous error.
I
get further into the program the first page displays but when I select one of my tables I get
'jquery'
is not a valid script name. The name must end in '.js'.Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: 'jquery' is not a valid script name. The name must end in '.js'. Source Error:
Line 39: Dim routeValues As New RouteValueDictionary(GridView1.GetDefaultValues)
Line 40: InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert, routeValues)
Line 41: MyBase.OnPreRenderComplete(e)
Line 42: End Sub
Line 43:
Source
File: C:\Users\cathy\Documents\Visual Studio 2013\WebSites\WebSite9\DynamicData\PageTemplates\List.aspx.vb Line:
41 Stack Trace:
[InvalidOperationException: 'jquery' is not a valid script name. The name must end in '.js'.]
System.Web.UI.ScriptReference.GetDebugName(String releaseName) +139
System.Web.UI.ScriptReference.ShouldUseDebugScript(String releaseName, Assembly assembly, Boolean isDebuggingEnabled, Assembly currentAjaxAssembly) +31
System.Web.UI.ScriptReference.DetermineResourceNameAndAssembly(ScriptManager scriptManager, Boolean isDebuggingEnabled, String& resourceName, Assembly& assembly) +97
System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip, Boolean useCdnPath) +105
System.Web.UI.ScriptReference.GetUrlInternal(ScriptManager scriptManager, Boolean zip, Boolean useCdnPath) +603
System.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, Boolean zip) +182
System.Web.UI.ScriptManager.RegisterUniqueScripts(List`1 uniqueScripts) +203
System.Web.UI.ScriptManager.RegisterScripts() +465
System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +124
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +121
List.OnPreRenderComplete(EventArgs e) in C:\Users\cathy\Documents\Visual Studio 2013\WebSites\WebSite9\DynamicData\PageTemplates\List.aspx.vb:41
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1155
When I use the toolkitscriptmanager I get the file must end in .js. I have upgraded to AjaxToolKit version 15.3 using nugget. With this new version they have done away with ToolKitScriptManager replacing it with ScriptManager. So I am using ScriptManager
now. The error I now get is "sys undefined" when it tries to render my autocomplete extender. I am now thinking I have missed something in making this website ajax enabled and am looking on the internet for turtorials on how to use the ajaxtoolkit. Thanks
for your help. I'll keep the post updated if I find a solution.
Member
1 Points
16 Posts
autocomplete extender to datascaffolding site
Sep 08, 2015 12:27 PM|cemmons57|LINK
I need to add an autocomplete extender to my list page. I have gotten this to work in the past but it uses ToolKitScriptManager instead of ScriptManager. Because the markup generated by the datascaffolding already has a Scriptmanger in the site.master page. I can't add another ToolKitScriptManager on the same page. So I changed the ScriptManger markup to ToolKitScriptManger . But I get the error 'jquery' is not a valid script must end in js. The code in the site.master follows.
<%
@ Master Language="VB" CodeFile="Site.master.vb" Inherits="Site" %>
<%
@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<!
DOCTYPE html>
<
html lang="en">
<
head runat="server">
<meta charset="utf-8" />
<title>Dynamic Data Site</title>
<link href="~/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</
head>
<
body>
<h1 class="DDMainHeader">Dynamic Data Site</h1>
<div class="DDNavigation">
<a runat="server" href="~/"><img alt="Back to home page" runat="server" src="DynamicData/Content/Images/back.gif" />Back to home page</a>
</div>
<form id="form1" runat="server">
<div>
<%
-- TODO: Enable partial rendering by setting the EnablePartialRendering attribute to "true" to provide a smoother browsing experience.
Leaving partial rendering disabled will provide a better debugging experience while the application is in development. --
%>
<asp:ToolKitScriptManager id=ScriptManager1 runat="server" EnablePartialRendering="False" CombineScripts="false" >
<Scripts>
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" />
</Scripts>
</asp:ToolKitScriptManager>
>
The page with the autoextender:
<%
@ Page Language="VB" MasterPageFile="~/Site.master" CodeFile="List.aspx.vb" Inherits="List" %>
<%
@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="aspToolKit" %>
<%
@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>
<
asp:Content ID="headContent" ContentPlaceHolderID="head" Runat="Server">
</
asp:Content>
<
asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
<DataControls>
<asp:DataControlReference ControlID="GridView1" />
</DataControls>
</asp:DynamicDataManager>
<asp:Label runat="server" ID="lblReferrerName" Text="Address: "></asp:Label>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:Label runat="server" ID="Label1" Text=" Select address and press button "></asp:Label>
<aspToolKit:AutoCompleteExtender ID="txtName_AutoCompleteExtender" runat="server"
DelimiterCharacters="" Enabled="True"
TargetControlID="txtName" MinimumPrefixLength="2" CompletionInterval="1000"
EnableCaching="false" FirstRowSelected="false" CompletionSetCount="100" ServiceMethod="GetDevelopments"
UseContextKey="True">
</aspToolKit:AutoCompleteExtender>
<asp:Button ID="Button3" runat="server" Text="Button" Width="67px" />
<h2 class="DDSubHeader"><%= table.DisplayName%></h2>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="DD">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
HeaderText="List of validation errors" CssClass="DDValidator" />
<asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" CssClass="DDValidator" />
<asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" />
<asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" /><br />
</ItemTemplate>
</asp:QueryableFilterRepeater>
<br />
</div>
<asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="true" />
<asp:QueryExtender runat="server" TargetControlID="GridDataSource">
<asp:SearchExpression SearchType="StartsWith" DataFields="LotAddress" >
<asp:ControlParameter ControlID="txtName" />
</asp:SearchExpression>
</asp:QueryExtender>
<asp:Button ID="Button1" runat="server" Text="Search" />
<br />
<asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
AllowPaging="True" AllowSorting="True" CssClass="DDGridView"
RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:DynamicHyperLink runat="server" Action="Edit" Text="Edit"
/> <asp:LinkButton runat="server" CommandName="Delete" Text="Delete"
OnClientClick='return confirm("Are you sure you want to delete this item?");'
/> <asp:DynamicHyperLink runat="server" Text="Details" />
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField Text="Add" DataNavigateUrlFormatString="~/SewerCleaningHeaders/Insert.aspx" />
</Columns>
<PagerStyle CssClass="DDFooter"/>
<PagerTemplate>
<asp:GridViewPager runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
There are currently no items in this table.
</EmptyDataTemplate>
</asp:GridView>
<div class="DDBottomHyperLink">
<asp:DynamicHyperLink ID="InsertHyperLink" runat="server" NavigateUrl=<%# table.GetActionPath("videolist", GetDataItem())%> Action="videolist"><img runat="server" src="~/DynamicData/Content/Images/plus.gif" />Insert new item</asp:DynamicHyperLink>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</
asp:Content>
The stack trace
[InvalidOperationException: 'jquery' is not a valid script name. The name must end in '.js'.] System.Web.UI.ScriptReference.GetDebugName(String releaseName) +139 System.Web.UI.ScriptReference.ShouldUseDebugScript(String releaseName, Assembly assembly, Boolean isDebuggingEnabled, Assembly currentAjaxAssembly) +31 System.Web.UI.ScriptReference.DetermineResourceNameAndAssembly(ScriptManager scriptManager, Boolean isDebuggingEnabled, String& resourceName, Assembly& assembly) +97 System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip, Boolean useCdnPath) +105 System.Web.UI.ScriptReference.GetUrlInternal(ScriptManager scriptManager, Boolean zip, Boolean useCdnPath) +603 System.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, Boolean zip) +182 System.Web.UI.ScriptManager.RegisterUniqueScripts(List`1 uniqueScripts) +203 System.Web.UI.ScriptManager.RegisterScripts() +465 System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +124 System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +121 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1155
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237
Star
8460 Points
1445 Posts
Re: autocomplete extender to datascaffolding site
Sep 09, 2015 01:14 AM|Klein Zhang|LINK
Hi cemmons57
According to your error message, you could refer to http://blogs.msdn.com/b/pranav_rastogi/archive/2012/09/21/asp-net-4-5-scriptmanager-improvements-in-webforms.aspx
Best Regards
Klein zhang
Contributor
4420 Points
874 Posts
Re: autocomplete extender to datascaffolding site
Sep 09, 2015 01:40 AM|Mukesh_Kumar|LINK
Hi,
As your error is clearly saying that you need to add .js with ScriptReference. Below is your code which is wrong... You need to pass Name which has .js extension.
Like same line below this you have mentioned the name with .js extention.
So, Please change the Name from Jquery to something else like ABC.js.
Hope this will help you.
Thanks
Member
1 Points
16 Posts
Re: autocomplete extender to datascaffolding site
Sep 09, 2015 11:31 AM|cemmons57|LINK
I tried the changes that were suggested at the website you indicated. Now I get the error
$create(Sys.Extended.UI.AutoCompleteBehavior, {"completionSetCount":100,"delimiterCharacters":"","enableCaching":false,"id":"ContentPlaceHolder1_txtName_AutoCompleteExtender","minimumPrefixLength":2,"serviceMethod":"GetDevelopments","servicePath":"/SewerCleaningHeaders/List.aspx","useContextKey":true}, null, null, $get("ContentPlaceHolder1_txtName"));
});
Unable to get property of UI of undefined or null reference
This is on my autoextender. I looked all over the internet and they say to change scriptmanager to toolkitscriptmanager. That's when I get the previous error.
My main page markup looks like
<
html lang="en">
<
head runat="server">
<meta charset="utf-8" />
<title>Dynamic Data Site</title>
<link href="~/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</
head>
<
body>
<h1 class="DDMainHeader">Dynamic Data Site</h1>
<div class="DDNavigation">
<a runat="server" href="~/"><img alt="Back to home page" runat="server" src="DynamicData/Content/Images/back.gif" />Back to home page</a>
</div>
<form id="form1" runat="server">
<div>
<%
-- TODO: Enable partial rendering by setting the EnablePartialRendering attribute to "true" to provide a smoother browsing experience.
Leaving partial rendering disabled will provide a better debugging experience while the application is in development. --
%>
<
script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.1.js" type="text/javascript"></script>
<asp:ScriptManager id=ScriptManager1 runat="server" EnablePartialRendering="False" >
<Scripts>
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" />
</Scripts>
</asp:ScriptManager>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</
body>
</
html>
I have also tried the following
<
head runat="server">
<meta charset="utf-8" />
<title>Dynamic Data Site</title>
<link href="~/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</
head>
<
body>
<h1 class="DDMainHeader">Dynamic Data Site</h1>
<div class="DDNavigation">
<a runat="server" href="~/"><img alt="Back to home page" runat="server" src="DynamicData/Content/Images/back.gif" />Back to home page</a>
</div>
<form id="form1" runat="server">
<div>
<%
-- TODO: Enable partial rendering by setting the EnablePartialRendering attribute to "true" to provide a smoother browsing experience.
Leaving partial rendering disabled will provide a better debugging experience while the application is in development. --
%>
<asp:ToolKitScriptManager id=ScriptManager1 runat="server" EnablePartialRendering="False" >
<Scripts>
<asp:ScriptReference Path="~/Scripts/" Name="jquery" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" />
</Scripts>
</asp:ToolKitScriptManager>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</
body>
</
html>
I get further into the program the first page displays but when I select one of my tables I get
'jquery' is not a valid script name. The name must end in '.js'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: 'jquery' is not a valid script name. The name must end in '.js'.
Source Error:
Line 39: Dim routeValues As New RouteValueDictionary(GridView1.GetDefaultValues) Line 40: InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert, routeValues) Line 41: MyBase.OnPreRenderComplete(e) Line 42: End Sub Line 43:
Source File: C:\Users\cathy\Documents\Visual Studio 2013\WebSites\WebSite9\DynamicData\PageTemplates\List.aspx.vb Line: 41
Stack Trace:
Member
550 Points
194 Posts
Re: autocomplete extender to datascaffolding site
Sep 15, 2015 05:46 AM|sudo10|LINK
http://stackoverflow.com/questions/18132190/error-with-ajax-extensions-for-asp-net-4-0
Member
1 Points
16 Posts
Re: autocomplete extender to datascaffolding site
Sep 15, 2015 12:08 PM|cemmons57|LINK
When I use the toolkitscriptmanager I get the file must end in .js. I have upgraded to AjaxToolKit version 15.3 using nugget. With this new version they have done away with ToolKitScriptManager replacing it with ScriptManager. So I am using ScriptManager now. The error I now get is "sys undefined" when it tries to render my autocomplete extender. I am now thinking I have missed something in making this website ajax enabled and am looking on the internet for turtorials on how to use the ajaxtoolkit. Thanks for your help. I'll keep the post updated if I find a solution.