Wednesday, March 28, 2012

Contacts sample Atlas application error

When I try to run the site locally, I get aConfiguration Error .

Server Error in '/Contacts' Application.

Parser Error Message:Could not load type 'Microsoft.Web.Services.WebResourceCompressionModule'. (c:\inetpub\wwwroot\contacts\web.config line 62)

Line 62 is:<add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/>

Also, I see this error in Visual Studio: Error 1 Type 'Microsoft.Web.UI.Controls.AutoCompleteProperties' does not have a public property named 'MinimumPrefixLength'. c:\inetpub\wwwroot\Contacts\DefaultFull.aspx 93

What do I need to modify here? Aren't these samples supposed to run without any tweaking?

Ooops...

Never mind. I just had to install the new March CTP of Atlas. I guess my installed version was a bit older.


Hi pmarangoni

The contacts\readme.txt has the following step to install and run the sample

ASP.NET 'Atlas' Contacts Sample


Setup
=====
Copy the following file:

C:\Program Files\Microsoft ASP.NET\Atlas\v2.0.50727\Microsoft.Web.Atlas.dll

to the Bin folder in the folder where you have the Contacts sample files.


Running the Sample
==================
1. Open Visual Studio

2. Open the Contacts project by following these steps:

a. In the "File" menu, click "Open Website."
b. In the "Open Web Site" dialog box, click the "File System" tab.
c. Navigate to the folder where you have the Contacts sample files, and
then click "Open".

3. Run the Default.aspx page.

4. Navigate in the GridView control.

Notice that paging or sorting does not require a postback.

5. Drag the "Add new contact" panel to a different location on the page.

6. Enter a new contact.

Note that the box provides auto-complete behavior.


Hi jhawk,

I've tried following the instructions on most of the samples, including the Contacts sample.I haven't gotten any Atlas sample to work. Some of them won't even compile because of javascript errors. Others have runtime javascript errors.

As far as Contacts go, "Default.aspx" doesn't use any Atlas. You have to run "DefaultFull.aspx". However, when I try to run the "DefaultFull.aspx" page, I get a runtime javascript error: "invalid argument".

I think the samples need some more careful review.

Consuming services from another application with Cassini

I have two projects in a solution: a Web Application (UI) project and a Web Service project. I can't get the UI to consume a web service if the projects are running using the built-in web server. My OnCompleted or OnError callbacks never get called. However, it works if I use IIS.

So the client ishttp://localhost:4312/default.aspx and it references the service using:

<atlas:ServiceReferencePath="http://localhost:1234/Service1.asmx"/>

If all I do is make them both IIS apps then change the reference as follows, it works a treat:

<atlas:ServiceReferencePath="/ServiceApp/Service1.asmx"/>

Is this because Cassini's use of different port numbers makes this appear as a forbidden cross-domain call?

BTW, I obviously made sure that Cassini was listening on both ports.

If the port's not the same yes you will get a crossdomain error.

But I don't think that's the only issue. Cassini listens to a specific port and sets up the ASP.NET runtime for a specific virtual directory. 1 port, 1 Virtual directory, 1 instance of Cassini.So unless youhave two separate instenaces of Cassini running the call won't work because it's effectively only servicing a single application. You'll need two instances of VS or Cassini to make this happen and I don't think you can do that either because only one instance can listen on a given port.

So, no you probably can't do that <s>... Use IIS and separate virtuals.

+++ Rick --


Yeah, thanks Rick. That's pretty much the conclusion I've come to. But I find it strange that the port is considered part of the domain. Cool blog by the way.

Stu

Consuming JSON Web Services?

Howdy,

I noticed that Atlas uses JSON to serialize/deserialize objects. Has anyone written an example of the best (most efficient, most elegant) way to consume a JSON Web service from an Atlas application?

(An example of the data I'd be going after is here: http://api.search.yahoo.com/ImageSearchService/V1/imageSearch?appid=jeffreymcmanus&query=bill+gates&results=2&output=json)

If you add "&callback=showResults" to the query, it will come back packaged to pass the JSON data into your custom "showResults" javascript method. Basically, you are getting back a string of client script. It's up to you how you want to handle it in the browser with your own javascript.

At least to me, that's the most elegant way, which is pretty much what you asked.

Peter

Consuming a webservice from a custom control extender

I am making a first attempt at writing own extender using the toolkit, and I need to consume a web service. When I Google on Ajax and webservice, I get a lot of articles, but they all seem to involve modifying the ScriptManager tag to point to the web service I want, and you can't rely on that from an extender paradigm. I know the autocomplete control uses some sort of web service, but picking the code out is tough. Is there a plain vanilla, Hello World type of example of how to consume a web service from a custom control extender?

There seems to be a couple of ways to do this, check this post:

http://forums.asp.net/t/1163304.aspx

Although I like mine betterSmile

Hope this helps,

Elias.


Thanks Elias, that's what I was looking for.

Constructors!

The only thing that REALLY winds me up about ASP.NET is the near total lack of useful constructors

I'd guess a lot of people want to do something like:

ContentPanel1.Controls.Add( new LinkButton("link3", "This is the Text", "http://some.url") )

BUT! you can't. You have all the pain of:

LinkButton link3 = new LinkButton();
link3.ID = "link3";
link3.NavigateURL="http://some.url";
link3.Text = "This is the Text";
ContentPanel1.Controls.Add(link3);

Declaratively, its beautiful, but there are some things that you just CANNOT DO declaratively, or at least you need to seriously hurt youself to manage it. Obviously, you can write helpful methods to immitate a ctor, but i'd really love to see decent ctors in both ASP.NET and ATLAS - ASP.NET is released, so i assume i've got no luck until V3.0 for that, but ATLAS is very much in devel, so any chance of a constructor or two (one on ControlEventTrigger would be great!)

hello.

yes, i also believe that the asp.net controls should have constructors which receive parameters. i guess that the problem is defining the important ones...if you really write a lot of code like the one you've presented, then i believe that your current best option is to write a factory class for those controls...it sucks, but...


Hi Luis,

I totally agree with you. In fact, some ASP.NET controls do have constructors that take parameters, such as SqlDataSource, though most do not. The factory pattern is probably your best bet here, especially since it lets you define exactly the properties that are important toyou, which might not be the same as the properties we would have come up with.

Edit: I also opened a suggestion bug so that we can investigate doing this for our controls in a future CTP.

Thanks,

Eilon

constrain reorder list drag area like Netflix

Is there a way to make the reorder list constrain the drag item to a column - like Netflix now does on the movie que ?

On the netflix site, when you drag a movie in the que to reorder it, the movie can only go up and down in the list ( you cant drag it all over the page like you can with the Ajax Reorder List...

Thanks for any help

bumpBig Smile anyone ?


Hi Uncleb,

I'm failed to logon the Netflix to get the effect due to the account issue.Based on your description,my understanding of what you want is that you want move a row from a list to another list. Just like move a row from a RecorderList to another.If I have miunderstood, please let me know.

Based on this knowledge, I'm afraid that we cannot achieve it by using RecorderList directly since it is difficult to drag an item across to another RecorderList.However, here is the information maybe you are looking for: http://www.isocra.com/articles/table_dnd.php .

I hope this helps.

Best Regards,

Jonathan


thanks Jonathan. The netflix control is a reorder style list that works almost the same way as ajax control, with a few differences.

The main difference is that when you drag an item, it can only go up or down in the list ( physically) The ajax reorder list allows the dragged item to be moved anywhere on the page ( though if it's not released on top of the reorder list , it does nothing)

Hard to explain without seeing it.

it similar to this...

http://demo.script.aculo.us/ajax/sortable_elements


Hi Uncleb,

Based on my research, I'm afraid we cannot find out a easy way to achieve your target except modify the source code. RecorderList is more complex than the most other controls in Ajax Control Toolkit. Fortunately, we can dip into the control since it is open source project. If you have any new finding , sharing them will be greatly appreciated.Thanks.

Best Regards,

Jonathan

Consistent nuisance with AjaxControlToolkit. Possible PublicKeys.

Hi.

I've been developing a web site in Visual Studio 2005. I had various problems with the Ajax Extensions such as ScriptManager and UpdatePanel. They were all of validation nature for ASP and sometimes went away without notice and sometimes opening up the Web.config was enough. Not logical to me I kept on and then finally ended up updating Visual Studio to Service Pack 1. All of the problems are now gone but then, new one surface.


Even when I make a new AjaxControlToolkit enabled web site, and just drag and drop a TextBox and AutoCompleteExtender, I get validation errors on both the AutoCompleteExtender and then the default added ToolkitScriptManager. The error I get is sometimes of the likes of

Error 34 Element'ToolkitScriptManager'is not a known element. This can occurif thereis a compilation errorin the Web site.

And yeah, the build failes. Then I get this error:

Error32Requestfor the permission of type'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
 
So, just so you know what I've tried to do to fix this. I've tried: * Searched the PublicKeyToken and changed it to all uppercase.

* Reinstalled the Ajax Extension msi
* Re-added the AjaxControlToolkit in to the Toolbox (reset it first).
* Put the Trust Level to Medium in web.config.
* Taken out PublicKeyToken on System.Web.Extensions

And this is happening to me with default values of all things. I really understand if some of you who are kind enough to try and help me can't reproduce this error but,
these errors have crippled my work for 2 days by now and it's really uncomfortible to realise that this tool that's supposed to help me is more a burden then help.
I can pass on a screenshot of this peculiar error and it's safe to say that I expected more from Microsoft.

Hi,

This seems to be a security issue, please specify trust level to FullTrust and try again.