Showing posts with label beta. Show all posts
Showing posts with label beta. Show all posts

Wednesday, March 28, 2012

ASP.Net Ajax elements not being recognized

I've just installed ASP.Net Ajax beta 2 and added its references to web.config, but my project still gives me some errors (my project was originally created using ASP.Net Ajax beta 1 template).

Here they are:

Warning 1 The 'requirePermission' attribute is not declared. c:\Inetpub\wwwroot\n2_lc1\Web.config 7 206 c:\...\n2_lc1\
Warning 2 The 'requirePermission' attribute is not declared. c:\Inetpub\wwwroot\n2_lc1\Web.config 8 200 c:\...\n2_lc1\
Warning 3 The 'requirePermission' attribute is not declared. c:\Inetpub\wwwroot\n2_lc1\Web.config 9 214 c:\...\n2_lc1\
Error 28 Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site. c:\Inetpub\wwwroot\n2_lc1\processo\acompanhamento_corrida.aspx 32 7 c:\...\n2_lc1\

What can I do?

When I create a new project it works. With existing projects it doesn't work.

Try to take a look at this reading when upgrading to Ajax Beta 2 -
????http://66.102.7.104/search?q=cache:6kV1ivEIoIYJ:ajax.asp.net/files/Migration%2520Guide.doc+Upgrade+Ajax+Migration&hl=en&ct=clnk&cd=1
????http://ajax.asp.net/files/AspNet_AJAX_CTP_to_Beta_Whitepaper.aspx
Wish the above can give you some helps.

Jasson, thanks for your reply, but the problem isn't migrating an Atlas to Ajax code. The problem I have is about the prefix ASP for Ajax controls that Visual Studio Intellisense is not recognizing.

Visual Studio marks the Ajax elements as unknown. Their elements only work if I change Ajax prefix to another one (different from ASP).


Sorry for not giving you an immediate reply.For your questions, try to follow up the following suggestions.

Do you have the following code line when you want to access Ajax control toolkit? This is necessary to refer to Ajax control toolkit in your website project. If not,try to add it

Monday, March 26, 2012

ASP.NET AJAX Beta 2 Sys errors

I've just installed and created an animation using Beta 2.0.

The problems I'm experiencing are that I'm getting the following (javascript) errors.

'Sys.Application' is null or not an object
'Sys.UI.DomEvent' is null or not an object
'Sys.Res.argumentUndefined' is null or not an object
'Sys.Res.enumValueNotInteger' is null or not an object

After searching google and the forums I've tried numerous suggestions to no avail. I've managed to narrow the cause of the errors down to a specific place. I only receive the errors when I include a couple of javascript files that have nothing to do with ASP.NET AJAX and work well without the animation in the page. The big difference with the javascript files is that they are two libraries that we use heavily in the project -- AdvancedAjax and JSON. When they are not installed the animation works perfectly. I hope you can shed some light on what I might be doing wrong.

You might want to check Scott Guthries blog - it discusses a "Sys is Undefined" error but may be related

http://weblogs.asp.net/scottgu/archive/2006/10/29/Tip_2F00_Trick_3A00_-Handling-Errors-with-the-UpdatePanel-control-using-ASP.NET-AJAX.aspx


Thanks for the quick response. However, I've already been to the link and tried the fixes mentioned there. I've also added the following snippet to my web.config to get the animation to work on some pages (pages without the advance ajax and json libraries included)

<

locationpath="ScriptResource.axd">
<system.web>
<authorization>
<allowusers="*"/>
</authorization>
</system.web>
</location>

I've followed the asp.net ajax install tutorial and have triple checked that everything that needs to be in there is in there including the

<addverb="GET"path="ScriptResource.axd"type="Microsoft.Web.Handlers.ScriptResourceHandler"validate="false"/>


Where in the web.config did you add that snipet?
just above the </configuration> at the end of the web.config...

The handler in the httphandlers section

<httpHandlers >
<removeverb="*"path="*.asmx" />
<addverb="*"path="*.asmx"validate="false"type="Microsoft.Web.Script.Services.ScriptHandlerFactory, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<addverb="GET"path="ScriptResource.axd"type="Microsoft.Web.Handlers.ScriptResourceHandler"validate="false" />
</httpHandlers>

And the

<locationpath="ScriptResource.axd" >
<system.web >
<authorization >
<allowusers="*" />
</authorization >
</system.web >
</location>

Like jody said, at the very end before the </config> and after the asp.net ajax </system.WebServer> tag

I've also tried adding my javascript files to the script manager and notifying Sys.Application by following the following located at [here (pops in new win)]. This did not work either, the same problems happened that I first posted about.



<asp:ScriptManagerrunat="server"ID="ScriptManager1">
<Scripts>
<asp:ScriptReferencePath="~/scripts/script_file1.js"/>
<asp:ScriptReferencePath="~/scripts/script_file2.js"/>
</Scripts>
</asp:ScriptManager>

After upgrading to Beta 2, any functionality that needs to use functions inside those files, was giving errors?!

After reading the"Changes between the ASP.NET AJAX ("Atlas") CTP and the Beta 2 and RTM Releases", I come to know that every external Javascript files that being referenced from ScriptManager must have a call toSys.Application.notifyScriptLoader; this will notify the Sys.Applicationthat the script files has been downloaded to the client computer, so for each external .js file add the following snippet:

if(typeof(Sys) !== "undefined")Sys.Application.notifyScriptLoaded();

Another solution thatAlessandro Gallo hasblog it is to add the following snippet to the end of each .js file:

if(Sys &&Sys.Application) {Sys.Application.notifyScriptLoaded();}


I was investigating the same bunch of Sys.Application errors on my website and couldn't solve the issue until I found the thread. I checked my .js files and added the aforementioned code to the end of each but the error still continued to show up. So I decided to remove blocks of code from one .js file to see if any of them cause any problem. And I found a piece that caused the problem!

I have the following code:

Object.prototype.startsFrom = startsFrom;

function startsFrom ( s2 )
{
return (this.toString().substring(0, s2.length) == s2 )
}

As soon I comment this piece out (it's enough to comment the first line of the piece), the errors are gone!

So if anyone has the same problem - check for this "Object.prototype..." kind of code in your .js files!

Hope this helps.

Vlad.


If your namespaces begin with Microsoft.Web.* (as I see some of the examples here doing), then you're pointing to the wrong ASP.NET AJAX version, I think. The 1.0 release of ASP.NET AJAX uses the System.Web.* namespace and web.config settings need to be set accordingly. Starting from the web.config that comes with ASP.NET AJAX or the Toolkit should get things off on the right foot.

Probably an error takes place because you are using a DatePicker or somecontrol that uses Javascript and that interferes with Ajax.NET.

Verify that you arent using other Javascript.

ASP.NET AJAX Beta 2 Bug

I have a popup window in a web project that on postback executes the following startup JavaScript:

window.opener.document.getElementById('rptrOtherCrit_ctl01_PTSValList1_hdnValues').value ='NJ';window.opener.__doPostBack('rptrOtherCrit$ctl01$PTSValList1$hdnValues','')window.opener.focus();window.close();

The hidden control in the opening page that is being modified is within an <asp:UpdatePanel> control. Everything works fine when using IE 6 but, when using Firefox 2.0 the following error appears in the Error Console:

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://localhost/TaxBrowser/ScriptResource.axd?d=rrMPh95m1EXHDVTP53sdlY7yEQVgCg7PqciEiGs1HCx_e6TnjvyveNwrB2X38b1_rlFCHP1MhbU0L_WYwgrZDpG_PF1uwTqLpZqVE5wb1XLd2paC8td9zt_W4KlqoZhrtCCwf7Z_N-6whUkZJdtjEe1ZeMEM-Pqb3wvBBXghujU1&t=633008283654152282 :: Sys$Net$XMLHttpExecutor$get_statusCode :: line 3509" data: no]
Source File: http://localhost/TaxBrowser/ScriptResource.axd?d=rrMPh95m1EXHDVTP53sdlY7yEQVgCg7PqciEiGs1HCx_e6TnjvyveNwrB2X38b1_rlFCHP1MhbU0L_WYwgrZDpG_PF1uwTqLpZqVE5wb1XLd2paC8td9zt_W4KlqoZhrtCCwf7Z_N-6whUkZJdtjEe1ZeMEM-Pqb3wvBBXghujU1&t=633008283654152282
Line: 3509


Certainly looks like a bug to me.

Try to test?it?in?IE?7.0,Opera,Escape?or?Safari?and?check?if?it?gets?the?same?error.Maybe?the?error?message?is?caused?by?
FireFox, not?Ajax?bug. Besides,can you post some codes here?This maybe?gives?us?to?fix?the?problem.
Try?to?debug?your?codes?and?fix?which?code?lines?cause?the?error?message.

I'm getting the same error (in firefox) just trying the sample at:

http://ajax.asp.net/docs/ViewSample.aspx?sref=Sys.Net.PageMethod%23PageMethod.aspx but not in IE 6. I'll try updating firefox


You need to add "[Microsoft.Web.Script.Services.ScriptService]" in front of the web service class in Ajax Beta 2.It is said this is a known bug in Ajax Beta 2.Try to add it and test your codes in IE,FireFox,Opera and Safari.Please let me know the testing results.

ASP.NET AJAX Beta 2 + ASMX Web Services = Parser Error !?!

Hi, I have my Web Services set up which works before ASP.NET AJAX installed. Now I am experiencing Parser Error when accessing my asmx web service.

My web.config is left untouched for the web services. The problem could be that the Web services is in the sub folders of my ASP.NET 2.0 + ASP.NET AJAX website. Please someone guide me on how to fix this error. It's quite urgent. Thanks!

Error Details:

System.InvalidOperationException: Failed to handle request. --> System.InvalidOperationException: Unable to handle request. --> System.Exception: Could not load file or assembly 'Microsoft.Web.Preview' or one of its dependencies. The system cannot find the file specified. --> System.Web.HttpParseException: Could not load file or assembly 'Microsoft.Web.Preview' or one of its dependencies. The system cannot find the file specified. --> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.Preview' or one of its dependencies. The system cannot find the file specified.

File name: 'Microsoft.Web.Preview'

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

at System.Reflection.AssemblyInternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.Load(String assemblyString)

at System.Web.Configuration.CompilationSection.LoadAssembly(String assemblyName, Boolean throwOnFail)

at System.Web.UI.TemplateParser.LoadAssembly(String assemblyName, Boolean throwOnFail)

at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistrationCore(TagNamespaceRegisterEntry nsRegisterEntry)

at System.Web.UI.MainTagNameToTypeMapper.ProcessTagNamespaceRegistration(ArrayList nsRegisterEntries)

WRN: Assembly binding logging is turned OFF.

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.

To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I feel that you need to install Ajax Futures CTP in your PC and the error message indicates that there is noMicrosoft.Web.Preview.dll to refer in your website.Try to check if you haveMicrosoft.Web.Preview.dllin the bin folder of your ajax website.If not,try to install ajax Futures Nov CTP first and add it to the bin folder.
Besides,try to read this thread?-http://forums.asp.net/1476672/ShowThread.aspx#1476672 if there is?any failure to call web service method.
Wish the above can help you.
Thanks! I added the needed dll into the bin folder and that fixed the problem. Thanks! It seems strange when I tested on my machine, things work but on the server it doesn't. Probably because of the inheritance of the web.config.
Try to check the permissions in the deployed server. Right mouse click virtual directory to addNetwork Service account and chooseProperties. Try to setexecute permissionsfor "Scripts only" or "Executable and Scripts"in the Virtual Directorypanel.Besides,try to set Trusted Level = Full.

asp.net ajax beta 1.0 dont recognize me the AutoCompleteExtender

hello

I need your help, i was working with the atlas last atlas CTP, but whe I read about asp.net ajx beta 1.0 , I changed my project to the nwe version but the AutoCompleteExtender doen't work , I install the latest CTP and I make areference to the Microsoft.Web.Preview.dll but I doesn't work , the error is that the tag is not recognized...

my code is:

<asp:AutoCompleteExtenderID="AutoCompleteExtender1"runat="server"

TargetControlID="txtProd"

ServicePath="~/Services/Services.asmx"

ServiceMethod="Find"MinimumPrefixLength="1"/>

Hi,

have you registered the namespace in your aspx page?

<%@. Register TagPrefix="ajaxPreview" Namespace="Microsoft.Web.Preview.UI.Controls" Assembly="Microsoft.Web.Preview" %>

Hi,

I had the same problem and the solution did the trick.

Thanks,

ASP.NET AJAX Beta 1 and AutoCompleteExtender

Have follow page:
1<%@dotnet.itags.org. Register TagPrefix="ajaxPreview" Namespace="Microsoft.Web.Preview.UI.Controls" Assembly="Microsoft.Web.Preview" %>23<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">45<html xmlns="http://www.w3.org/1999/xhtml" >6<head id="Head1" runat="server">7<title>test autocomlete</title>8</head>9<body>10 <script language="javascript">11 function onClick()12 {13 SearchService.GetAutoCompleteList("a",10, function(a1){alert(a1);} );14 }151617 </script>18 <form id="form1" runat="server" defaultfocus="UserNameTextBox">19 <asp:ScriptManager ID="MainScriptManager" runat="server" >20 <Services>21 <asp:ServiceReference Path="~/Services/SearchService.asmx" />22 </Services>23 </asp:ScriptManager>2425 <input type="button" id="btn" value="custom call" onclick="onClick();" />26 <asp:TextBox ID="tbSearch" runat="server" /><br /><br />2728 <ajaxPreview:AutoCompleteExtender ID="extSearchAutoCompleteExtender" runat="server"29 MinimumPrefixLength="1" Visible="true"30 ServicePath="~/Services/SearchService.asmx"31 ServiceMethod="GetAutoCompleteList"32 TargetControlID="tbSearch" />33 </form>34</body>35</html>36

and service:

[WebService][ScriptService]public class SearchService : WebService { [WebMethod] [ScriptMethod(true)]public string[] GetAutoCompleteList(string PrefixText,int count) { ... } }

When i press button - it works. But AutoCompleteExtender not work.
I debug internal JS Code. it seems that Request to server was send in JSON format, but not parsed on server properly, and call not come to Service.
I set breakpoint in service - it never come to it when use AutoCompleteExtender. But in Fiddler i can see that request goes to server.

in Jule CTP same code was works fine.

In anywherein new documentation has sample with AutoCompleteExtender ? how use it in ASP.NET AJAX Beta 1

hello.

it seems like you're using get for the request. try removing true from the scriptmethod and see if it works.


Initialy it was without true, but not work too.

I place true, when try to fix with. By Http Traces this flag not change anything.

I'm found a problem, but not know how to fix it.

when i call service with button follow package was send:

{"PrefixText":"a","count":10}
but when i type "a" in text box: content will be follow:
{"prefixText":"a","count":10}
 and response from server:
 
"@._Error(false,"Invalid web service call, missing value for parameter: \'PrefixText\'."," at Microsoft.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2 parameters) at Microsoft.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters) at Microsoft.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams) at Microsoft.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","System.InvalidOperationException")Error_@."
Why in second case parametr prefixText starts with non Capital letter?


if I change Service Method signature form
public string[] GetAutoCompleteList(string PrefixText,int count)

to

public string[] GetAutoCompleteList(string prefixText,int count)
AutoCompleteExtender works fine. But i have no clue why it works so.
Can anyone explain why i need parametrs started from nonCapital letter?

First off... thanks for posting this (along with the solution) as i just ran into that error as well (Fiddler is so great for helping debug, eh)

Anyways, to maybe make an attempt at answering:

mogadanez:

Can anyone explain why i need parametrs started from nonCapital letter?

Perhaps since the "closure" to "prototype" change that capitalization became important? that's just a wild shot in the dark


Just to backup my wild shot in the dark, using fiddler to poke around the javascript files spit out by the ScriptManager it has:

Sys.Net._WebMethod._invoke(this, this._serviceMethod, this._serviceMethod, false,
{prefixText : this._currentPrefix, count: this._completionSetCount },

when i call service method "by hand"

<script language="javascript">
11 function onClick()
12 {
13 SearchService.GetAutoCompleteList("a",10, function(a1){alert(a1);} );
14 }
15
16
17 </script>
...
19 <asp:ScriptManager ID="MainScriptManager" runat="server" >
20 <Services>
21 <asp:ServiceReference Path="~/Services/SearchService.asmx" />
22 </Services>
23 </asp:ScriptManager>

it's work with any parametrs names "PrefixText", "prefixText", and "BLABLA"
It is not work from AutoCompleteExtender ( and maybe from other components )

and i have no idea why.


hello.

that's weird...i've just tested with a simple page and i've named the parameter PrefixText and it works without any problem...


in simple service call? or in AutoCompleteExtender?

mogadanez:

if I change Service Method signature form

public string[] GetAutoCompleteList(string PrefixText,int count)

to

public string[] GetAutoCompleteList(string prefixText,int count)

AutoCompleteExtender works fine. But i have no clue why it works so.

I had the exact same problem and was getting very frustrated by it. This fixed my problem perfectly. Thank you for posting this fix.

Devteam, Can we get updated documentation showing these sorts of updates or atleast some form of example for the AutoCompleteExtender.


Another big thanks here !!!

I thought I was going nuts, how much can go wrong in configuring the autocomplete extender.

changing PrefixText to prefixText was all it took.

Kuddo's !


This problem is true for VB.net also. Thanks for the help.
hello guys. just like to confirm if this behavior happens when you use the internal server or only with iis. thanks.
I am using Localhost with IIS

ASP.NET AJAX Beta 1 and Adding a ScriptManager dynamically

I just upgraded to ASP.NET AJAX Beta 1 from the July CTP and am having problems with dynamically adding a ScriptManager to my page. It was working fine before I upgraded.

What I was doing before was this: I created a new class that inherited from Page and in the constructor of that class I created a ScriptManager object and add it to the Controls collection. That was working fine before. Since the upgrade, I am getting the following error when trying to add the ScriptManager in the constructor:

Control 'ctl00' of type 'ScriptManager' must be placed inside a form tag with runat=server.

So I tried adding the ScriptManager to the Form.Controls collection during the page's Init event, but then I got this error because I have an UpdatePanel on the page:

The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

So my question is how do I dynamically add a ScriptManager to the Form.Controls collection before an AJAX control checks for it?

Thanks!

hello.

well, you must add it before the updatepanel is added to the page. try using the preinit event and let us know if it works.


I tried to add it to the page during the PreInit event as well, since the AJAX controls apparently verify that a ScriptManager is on the page between the PreInit and Init events. Unfortuantly during the PreInit event the Form property of the page has not been created yet. So if I add the ScriptManager to the page's Controls collection as opposed to the Form.Controls collection during the PreInit event I get the same error that I stated above:

Control 'ctl00' of type 'ScriptManager' must be placed inside a form tag with runat=server.

Do you see any way around this?

Thanks for your response!


hello.

hum...can you post a small demo page which reproduces the problem while adding the scritpmanager dynamicaly?

thanks.


Yeah sure. Here is a very small example that shows the problem I am having. If I try to add the ScriptManager in the page's constructor then I get the error message about it having to be in between the page's form tags. If I create the ScriptManager during the PreInit event I get an error that says the UpdatePanel needs a ScriptManager. By the way, the project I created for this demo was from the ASP.NET AJAX CTP-Enabled Web Site template.

ASPX Page:

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Script Manager Test</title></head><body> <form id="form1" runat="server"> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> Testing... </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>
Code Behind:
 
using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Microsoft.Web.UI;public partialclass _Default : Page {public _Default() {//This tells me the ScriptManger must be in between the Form tags //if (ScriptManager.GetCurrent(this.Page) == null) //{ // ScriptManager Manager = new ScriptManager(); // Manager.EnablePartialRendering = true; // this.Controls.Add(Manager); //} }protected override void OnPreInit(EventArgs e) {if (ScriptManager.GetCurrent(this.Page) ==null) { ScriptManager Manager =new ScriptManager(); Manager.EnablePartialRendering =true;this.Controls.Add(Manager); }base.OnPreInit(e); }}


Try this:

if (ScriptManager.GetCurrent(this.Page) ==null)
{
ScriptManager Manager =new ScriptManager();

Manager.ID = "SM";
Manager.EnablePartialRendering =true;
this.Controls.Add(Manager);
}


Actually, you'll need to ensure that the ScriptManager is first in the page. For example:

<%@.PageLanguage="C#"AutoEventWireup="true" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Script Manager Test</title>

</head>

<scriptrunat="server">

protectedoverridevoid OnPreInit(EventArgs e) {

if (ScriptManager.GetCurrent(this.Page) ==null) {

ScriptManager Manager =newScriptManager();

Manager.EnablePartialRendering =true;

SMPlaceHolder.Controls.Add(Manager);

}

base.OnPreInit(e);

}

protectedvoid trigger_Click(object sender,EventArgs e) {

label.Text ="Async post";

}

</script>

<body>

<formid="form1"runat="server">

<div>

<asp:PlaceHolderID="SMPlaceHolder"runat="server"/>

<asp:Buttonrunat="server"Text="Click"ID="trigger"OnClick="trigger_Click"/>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<Triggers>

<asp:AsyncPostBackTriggerControlID="trigger"/>

</Triggers>

<ContentTemplate>

<asp:Labelrunat="server"Text="Get"id="label"/>

</ContentTemplate>

</asp:UpdatePanel>

</div>

</form>

</body>

</html>


That did not fix the problem. It still gives me the following error:

The control with ID 'UpdatePanel1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

If I remove the UpdatePanel from the page it then gives me this error message:

Control 'SM' of type 'ScriptManager' must be placed inside a form tag with runat=server.


Thanks, SimonCal, that worked to add the PlaceHolder and then add the ScriptManager to it, but that defeats the whole purpose of what I am trying to accomplish. I want to create a base class that inherits the Page class and have the ScriptManager automatically added. That way I can create a new page that inherits my base class and not have to worry about adding the ScriptManager manually every time. Before the beta came out I could add the ScriptManager to the page's Controls collection and it worked perfectly. Now the ScriptManager has to be in the form tags. Is there anyway to accomplish this?

Thanks for your help.


If you have to do it in a generic way from a base class - you can try the following

<%@.PageLanguage="C#"AutoEventWireup="true" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Script Manager Test</title>

</head>

<scriptrunat="server">

protectedoverridevoid OnPreInit(EventArgs e) {

if (ScriptManager.GetCurrent(this.Page) ==null) {

ScriptManager Manager =newScriptManager();

Manager.EnablePartialRendering =true;

foreach (Control cinthis.Controls)

{

if (cisHtmlForm)

form1.Controls.AddAt(0, Manager);

}

}

base.OnPreInit(e);

}

protectedvoid trigger_Click(object sender,EventArgs e) {

label.Text ="Async post";

}

</script>

<body>

<formid="form1"runat="server">

<div>

<asp:Buttonrunat="server"Text="Click"ID="trigger"OnClick="trigger_Click"/>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<Triggers>

<asp:AsyncPostBackTriggerControlID="trigger"/>

</Triggers>

<ContentTemplate>

<asp:Labelrunat="server"Text="Get"id="label"/></ContentTemplate>

</asp:UpdatePanel>

</div>

</form>

</body>

</html>

Thanks,

Kashif


That did the trick! That's exactly what I was looking for. Thank you very much, kashif!

How do you do this from inside a control? Like.....check to see if its there, then if its not then place it on the page that contains you Atlas control...?


protectedoverridevoid OnPreInit(EventArgs e)

{

if (ScriptManager.GetCurrent(this.Page) ==null)

{

ScriptManager Manager =newScriptManager();

Manager.EnablePartialRendering =true;

foreach (Control cinthis.Controls)

{

if (cisHtmlForm)

{

c.Controls.AddAt(0, Manager);

}

}

}

base.OnPreInit(e);

}

use this code in base class

don't write code in html file

don't hardcode form name in code

thank u


Similar thread:

Is it possible to add a ScriptManager to a page dynamically?

asp.net ajax 2.0 beta 2 error

hi..

i am using asp.net ajax 2.0 beta 2, with scriptManager with any ajax control in the control tool kit, and i get this error:

Sys.WebForms.PageRequestManager._initialize(

'ScriptManager1', document.getElementById('form1'));

'sys' is undefined.

when i get back and use atlas dll, instead of Microsoft.Web.Extensions dll, everything is ok...

why is that?

Hi ya,

I had similar problem two weeks ago. It was that my web site was not properly migrated to an ajax enabled web site. You need to modify your web config to be able to migrate it properly.

http://ajax.asp.net/files/Migration_Guide.doc

here is a document how you should do that.

Cheerz,

Yani

ASP.NET Ajax 1.0 Installation Error

I'm trying to install ASP.NET Ajax 1.0. First, I uninstalled a previous beta version. Now when I run the 1.0 installation and the wizard starts copying files, I get the following error:

Product: Microsoft ASP.NET 2.0 AJAX Extensions 1.0 -- Error 1304. Error writing to file: System.Web.Extensions.Design.dll. Verify that you have access to that directory.

Does anyone know how to resolve this issue?

Thanks.

I had a different problem, I couldn't get a clean uninstall on my XP dev box. But I followed the procedure in the following post:Uninstall issue with ASP.NET AJAX 1.0 Beta 2;http://forums.asp.net/thread/1502566.aspx.

I'm wondering if you got a clean uninstall.

Otherwise, I'd check the obvious. Look for the System.Web.Extensions.Design.dll file in your file system (mine is located at c:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025) and make sure the account you're using for the install has permission to write to the directory (like the error says :).


Thanks for the reply. I've tried both of your suggestions, but neither worked. The version I had installed was the "Atlas" June CTP. I've tried installing Beta 2, RC1, and 1.0. All of these give me this same error:

Product: Microsoft ASP.NET 2.0 AJAX Extensions 1.0 -- Error 1304. Error writing to file: System.Web.Extensions.Design.dll. Verify that you have access to that directory.

Any other ideas?...Please?....Anyone?...Help!


Does the System.Web.Extensions.Design.dll file already exist on your system? Unless it the error message is wrong it sounds like the file is there and you can't overwirte it. I know that I'm stating the obvious and asking you to check the obvious, but unfortunately I've been burned by the obvious too often not to check it :)


No it does not exist on my system. Let me rephrase that...The only time it exists on my system is during the installation of ASP.NET Ajax Extensions. In the middle of the installation, the System.Web.Extensions.Design.dll file is written to the C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025 folder. I think (and I'm guessing here) that the problem arises when the installation tries to add this assembly the GAC. I copied the file to another folder before cancelling the installation. Then I tried to add it to the GAC manually, but I received the following error:

You do not have rights to add assemblies to the assembly cache. Contact your system administrator for assistance.

This itself is a bit baffling considering that my user account is in the Aministrators group on this system.


Yes this does sound frustratingly interesting. If I were in your situation I'd try (1) adding then removing another signed assembly with gacutil to the GAC to see if your account really does have a problem. (2) creating a fresh admin account to see if it has the problem.

Also try clearing out the download cache. Try "gacutil /ldl" followed by "gacutil /cdl". During development I've had some problems with the download cache in the past, so clearing it is on my check list.

I guess the good news it seems like it may only be a permission problem. Unless the dll has been corrupted, you know that the dll is OK because Ajax RTM V1 has been widely installed. You could always grab a fresh copy of the Ajax v1 to make sure all is well.

If you haven't already taken the time, you might want to read the upgrade instructions and see if they provide any insights:

http://ajax.asp.net/documentation/default.aspx?tabid=47

http://ajax.asp.net/documentation/Migration_Guide_CTP_to_RTM.aspx

ASP.NET AJAX 1.0 Beta Documentation problem

I just transfered my code to new AJAX release. There is a lot of problem with documentation of this version. We need it more to be able to use this version of AJAX library.

Some of problems: In the previous version I can get hmtl select control currently selected value easily but no it is a problem...

lstboxUsers = new Sys.UI.Select($get('lstboxUsersId'))

lstboxUsers.get_selectedValue();

Is there any way to do this in new version, I solve much harder problems but this one stay ansolved :).

Regards,

Shegi

Note that the select control is in the Preview bits now and was renamed to 'Selector' in order to make it work for xml-script in Safari. The following should work for you:

var lstboxUsers = new Sys.Preview.UI.Selector($get('lstboxUsersId'));

var selection = lstboxUsers.get_selectedValue();


Thanks Chenriks, can you tell me one more thing?

In previous version of AJAX library it was possible to add click handler on selector control (code is below). What is the syntax in new version of AJAX? Do you have access to some kind of documentation for this?

lstboxUsers.selectionChanged.add(UserOnSelectionClick);

// List Box changes

function UserOnSelectionClick(sender, args)

{

}

Regards,

Shegi


it's:

lstboxUsers.add_selectionChanged(UserOnSelectionClick);

I hope it helps

AW

ASP.NET AJAX 1.0 Beta - Unable to use asp:ScriptManager in Control Toolkit and samples

Hi All,

I have uninstalled all the ATLAS related things using “Add or Remove Programs” and installed ASP.NET AJAX 1.0 Beta in the following way

Step 1 – Download and installed ASP.NET AJAX 1.0 Beta

Step 2 – Download and installed ASP.NET AJAX CTP

Step 3 – Download the ASP.NET AJAX Samples

Step 4 – Download the ASP.NET AJAX Control Toolkit

Now I can create new websites but I am unable to run the Samples and Control tool kit samples. I am getting JavaScript errors 'Sys' is undefined, Expected '}' etc.

I have even tried changing asp:ScriptManager to aspatlas:ScriptManager as mentioned in some blogs

Anyone facing such problems ?

Did you build the toolkit solution? I think by default when you download the source that you have to before you run the samples as the bin folder of the sample website does not have the toolkit dll...


Thanks Jodywbcb for your quick reply.

I have build the solution before running the toolkit. Also for the sample applications (Contacts, SimpleList and TaskList) I have copied Microsoft.Web.Preview.dll from the ASP.NET AJAX CTP installation directory (%Program Files%\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\) to the Bin directory of each sample application.

None of the samples are working in my system. But I can run the tool kit fromhttp://ajax.asp.net/ajaxtoolkit/ in my system.

I also tried reinstalling, restarting etc... No hope...


No problem... Can you post a a screenshot or capture of the error message you are recieving?

Sounds to me like for whatever reasons you are not able to GAC the Microsoft.Web.Extensions.dll for whatever reasons .. if you have the preview then you should have that dll ( its in the same folder you copied the preview stuff from btw if not revisit the Ajax announcement page and do step 1...). So try copying the dll I listed to the AjaxControlToolkit\SampleWebSite\Bin - it will search for it there if not in the GAC and let me know if you have any issues from that point. If you are installing the kit on a laptop / desktop that actually does set restriction that may be the cause - but copying the dll to you bin should allow it to run as there is nothing explicitly documented with this release that it needs to be GACed...


Error is 'Sys' is Undefined, 'Type' is Undefined, Expected '}'. Also I am unable to use intellisense in VS 2005 forasp:ScriptManager and other ajax elements. The error is "Element ScriptManager is not a known element"

Microsoft.Web.Extensions.dll is already there in GAC. Even after coping it to the BIN folder error exists.


Ref:My blog and see if anything helps you - the toolkit example does work as intended if everything is properly installed but there are workarounds...

I have tried running toolkit samples in 3 different systems and got the following observations

1. I have copied the AjaxControlToolkit folder to all the 3 systems and installed Microsoft.Web.Extensions.dll in GAC

2. I can successfully build and run the application using VS 2005.

3. When I open any one page (Any Ajax sample page)first time it will work

4. When I open some other page I will get the JavaScript error I mentioned

5.After that none of the page will work (Including the first page which successfully executed) in that system


I have the exact same problem with the samples.

I've noticed that the web.config has a namespace entry under system.web -> pages -> controls with tagPrefix="asp" for both the preview and extensions dlls, so maybe the problem is related to those dlls.


Could it be that you're missing some javascript files?

Re: Intellisense not working, did you try removing all the Atlas components from Visual Studio and re-adding the new 1.0.6x NET Framework Components? Also, make sure you have the new files in Bin folder.


Do I need to explicitly add any JavaScript files for the toolkit? New dll's I copied to the BIN folder.

Is there anyone who is successfully using the toolkit? I have tried installing it in more than four systems (In all the systems ATLAS was there)

The very first sample I can run, After that no hope to run any sample in that system.


Gary A. Stafford:

Re: Intellisense not working, did you try removing all the Atlas components from Visual Studio and re-adding the new 1.0.6x NET Framework Components? Also, make sure you have the new files in Bin folder.

I've installed it on a machine with a fresh VS2005 installation, meaning no Atlas component.

I've copied the 'Preview' and 'Extensions' dlls to the bin folder, if thats what you meant.


It seems that the caching issue solved in the ASP.NET AJAX 1.0 release. Now there is no script error!! Smile

Thanks

Wednesday, March 21, 2012

ASP components inside UpdatePanel been red underlined

I'd like if anyone has experienced the same issue than me.
Since I updated to Ajax Beta 1, each object or components that I placed inside an update panel aren't recognized, all are red underlined, and which is more annoying, and even if I'mm being able to complete the compilation and run the application, a lot of errors messages are being throwed (for example: Error 31 Element 'RadioButtonList' is not a known element. This can occur if there is a compilation error in the Web site) and it makes a little bit difficult to find errors during debugging.

I suppose I had missed a step during the upgrading, because I have not heard about other people with the same issue.

Any hint/suggestion to put me on the right way the solve this is welcome!!!

Thanks,

Scott Gu has a Gotcha on this. See his blog for the explanation.

Asp Ajax Extensions Beta1 and web config

Do I need to make any changes in my web config to use the new Asp Ajax Extensions Beta 1?

Everything worked with the last version.

Thanks

have you seen the migration guide that's posted on this page:http://ajax.asp.net/default.aspx?tabid=47

this is the link to the guide:http://ajax.asp.net/files/Migration%20Guide.doc

Asp Ajax Beta 1, ScriptPaths Debug file loads after the WebResource file.

<rant>

The ASP Ajax Beta 1, still downloads it's javascript WebResources even when the ScriptPath to the file you want to debug has been supplied!!!!

Is this a bug??

How do you stop it from doing this?

</rant>

I have a custom extender written using the September CTP, which worked very well, and when using the ScriptPath attribute allowed me to debug the .js file easily.

I have now switched to the Asp Ajax Beta1 and cannot debug my extender .js files, even with the ScriptPath set on the extender control.

The problem appears to have be caused because the server insists on downloading the Js file set up in the ClientScriptResource attribute as the extender's WebResource,

even when you supply the script path to the file. Therefore if you have a syntax error in the js, the page stops loading, and you can't even find the line of code causing the problem.

How do you stop the server deciding to download this web resource before the debug version of the file!

I have simple solution the demonstrates my problem, let me know if you want me to email it to you.

Hi Stefan. Can you post your specific code here that you are trying to use in the Beta?

asking about ajax 1.0 realesd ?

hi dev.

im using ajax 2.0 beta in my application. and i used ajax controls on it. now when i installed the new ajax all my pages had errors. can i do something easy to uypgrade it to new ajax? or stay on the beta version?

and if i stay use the beta does that make problems in the future?

thanks

Hey jaffar,

you might have a look atConverting Applications from "Atlas" CTP to ASP.NET AJAX RTM . Basically there a various naming scheme changes. E.g. the <atlas:XY tag changed to <asp:XY ...You also have a look at your web.config.

I suggest you to upgrade to the AJAX release version. The CTPs or betas are not supported, neither you can install current Control Toolkit builds.

regards

Henrik


hi henrikholle

the problem i uninstalled the beta one and installed the new one BUT the application gave me 101 errors DUH

so i think ajax team must thought about that and should do something. now i think i have to stay on the beta.


Hey,

just have a look at the converting guide. The guide describes the converting process from your beta version to RTM 1.0 in detail.Read here


regards

henrik

asbx support in AJAX ASP.NET

I 've just download the new AJAX ASP.NET beta, and I'm trying to figure out where is the Microsoft.Web.Services.BridgeBuildProvider . Does this beta still support the asbx files and bridges? Where is the documentation?

somebody? bridge and asbx files ... what's going here?Confused


Unfortunately asbx and Bridge support are not in the current release.

will they be available in the final release? I found them very very very useful ... please

thanks


I'm waiting for them too. Especially after googling for answers and seeing and trying all related samples... which of course are working with the older previous release... but not with the beta one... If I wouldn't had found this post maybe I would still been trying to get it running...

Will this feature be available in the next versions? I need to take decisions based on your answer.

Thanks


Does something else take the place of the bridge (asbx) capability? Is there another way to use Javascript to call my remote web services?


You can always have your Web application make the Web Service calls and then hook up those calls with front end methods with local Web Service or PageMethods methods.

I would argue that this is a more reliable mechanism anyway although it does require an extra layer of abstraction.


The extra layer of abstraction requires more time. I also think that the bridging support is an excellent feature.

I need to build an application that calls in an asynchronuos way multiple web services from different domains...


Well the good news is due to customer feedback, it looks like the bridge feature will be brought back as part of the Value Add, so you'll be able to use bridges again...

Hope that helps,
-Hao


For sure it helpsBig Smile. Thanks HaoK, these are really excellent news ( I was thrilled by the bridging part, it matched like a glove my needs ) .

Any ideea about the next date release which will support this feature? Or I should simply try to continue/start working on Atlas July CTP(I remember this is the before the last one release) and update what I have when the new version will be available?

By Value Add you mean AJAX CTP? Or?...

Thanks again


I do not think that there is something else in place of bridging ...

As far as I know: you can still call web services using JS. Have a look at the following threads:

http://forums.asp.net/thread/1449674.aspx

http://forums.asp.net/thread/1172624.aspx

Hope this helps.

One thing I remember is that if you call a web service method using javascript, and the web service method is located under the same share as the web application, the method has to be defined in the .aspx file using <script language="C#">...</scipt>, and this is because of an issue present in the Beta version only(someone please correct me if I'm wrong).


Hao,


Great news that it is being brought back. I have a couple questions: 1) I was told it would be in beta 2, but have seen no documentation or mention of it with today's release? 2) Why was it removed? It seems like a very useful feature. Or, as Rick mentions above, is it considered a better practice to have a local webservice call to an external service? Seems like a lot of hassle...

Thanks,


Brian


It was added very late, so the docs didn't have time to be updated, but all the old Microsoft.Web.Services.Bridge* classes now live under Microsoft.Web.Preview.Services.*

Hope that helps,
-Hao


Thanks Hao,

We are trying to get our old bridge code working, and running into some confusing errors. It seems that the calls are working, the generated BridgeHandler is being hit, and the parameters are coming in correctly (we can see them in the debugger) but when it tries to convert the first item in the parameter Dictionary, it fails with a null reference error, even though that item (obj) can be seen in the debugger as having a value of "1"

if (args.TryGetValue("businessPurposeTypeID", out obj)) {
// Not sure why there are so many empty if statements
}
else {
throw new System.ArgumentException("Argument not found: businessPurposeTypeID");
}
arg0 = ((int)(this.ConvertToType(obj, typeof(int))));

The line with "ConvertToType" is the line that's failing. See the following stack trace returned in the javascript result:

"@._Error(false,"Object reference not set to an instance of an object."," at Microsoft.Web.Preview.Services.BridgeHandler.ConvertToType(Object argValue, Type paramType)\r\n at MLDB.Website.WebServices.MLDBSearchBridge.CallServiceClassMethod(String method, Dictionary`2 args, ICredentials creds, String url) in c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files\\mldb.website\\3254fa88\\e4e20f8b\\App_Web_-q50ig-3.0.cs:line 104\r\n at Microsoft.Web.Preview.Services.BridgeHandler.ProcessRequest()\r\n at Microsoft.Web.Preview.Services.BridgeHandler.ExecuteBridgePipeline()\r\n at Microsoft.Web.Preview.Services.BridgeHandler.Invoke(BridgeRequest request)\r\n at MLDB.Website.WebServices.MLDBSearchBridge.LoadListingResults(IDictionary args) in c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files\\mldb.website\\3254fa88\\e4e20f8b\\App_Web_-q50ig-3.0.cs:line 70","System.NullReferenceException")Error_@."

Any suggestions?


I have a simpler question. I've downloaded and installed theASP.NET AJAX 1.0 beta 2 release, and now I'm trying to simply get themashup examples from the videos to work. Specifically the Amazonand Flickr example:http://download.microsoft.com/download/f/9/c/f9c970a0-0401-4863-9f03-981e513a2f1c/HDI-AtlasMashUp.wmv

Usingbridging for mashups is a central focus for me, so if someone has thisworking on the current release if they could post the code it would begreat. I've tried to hack my way through with the migration guideand so forth, but when I load the page and click the button it can'tfind "Samples", which is the namespace used by the two .asbxfiles. I have a feeling that it's a web.config problem or maybean IIS config problem, but I'm working in the dark ...

thanks,

Robert